Questions tagged [gspread]

1

votes
0

answer
322

Views

Using gspread AttributeError: 'Worksheet' object has no attribute 'get_addr_int'

I'm using gspread to modify a Google Sheets, but I keep getting this error when I run it: AttributeError: 'Worksheet' object has no attribute 'get_addr_int' Here is my code: import json import gspread from oauth2client.client import SignedJwtAssertionCredentials json_key = ### scope = ['https://...
user9486913
1

votes
1

answer
1.1k

Views

Google Sheets with Python Insufficient Permission

I am trying to use python and google sheets together. This is my code: import gspread from oauth2client.service_account import ServiceAccountCredentials #use creds to create a client to interact with the Google Drive API scope = ['https://spreadsheets.google.com/feeds'] creds = ServiceAccountCredent...
M. Freberg
1

votes
1

answer
84

Views

creating a dataframe from specific range in googlesheet

My gsheet has different data set in a single sheet. I want to create a data frame from a specific range of cells (E1:K20000). I am using the below code for that using pandas: sh5= gc.open_by_url('Link of spread sheet') wks5=pd.DataFrame(sh5.worksheet_by_title('Pincode - fos').range('E1:K7')) wks5.he...
Rajat Jain
1

votes
1

answer
60

Views

Checking if elements are part of list and creating a new list

So I have two lists (it is extracted from google sheets via gspread library) One column from the google spreadsheets had all the brand names. I got this whole column and created a list called 'approved_brand'. I got another column and called it 'approved_seller'. These brands and sellers (in the gra...
Gary Kim
1

votes
0

answer
34

Views

gspread raise ResponseNotReady

When i try to use gspread to access google spreadsheet, it always returns 'raise ResponseNotReady()', i just follow the user guide in Github, and i'm not familiar with httplib and gspread, could someone tell me how to make it right, thank you for you kind help the source code: import gspread from oa...
刘仁辉
1

votes
0

answer
124

Views

Sort a spread sheet via gspread

I have a Google spreadsheet full of names, dates, and some other numbers. I made an desktop application that provides a nice UI for said info. After using the application a bit I became slightly annoyed with the order the data was being displayed. I have been researching all day and I cannot seem...
brainytwoo
1

votes
1

answer
329

Views

DataFrame max() not return max

Real beginner question here, but it is so simple, I'm genuinely stumped. Python/DataFrame newbie. I've loaded a DataFrame from a Google Sheet, however any graphing or attempts at calculations are generating bogus results. Loading code: # Setup !pip install --upgrade -q gspread from google.colab impo...
JamesM
1

votes
0

answer
157

Views

python3 gspread exception not caught

I have the following piece of code which attempts to capture a gspread.exceptions.APIError, usually as the result of a timeout of the Google spreadsheet credentials. _open_sheet requests a new set of credentials. def _findRow(self, entry): ''' Return row index for row which contains 'entry'. ''' fo...
Mark Schulz
1

votes
2

answer
146

Views

GSpread pass credentials from Python not JSON

Im using GSpread trying to pass the content on my JSON file (Google API Service Application credentials) as a python Dictionary on my script. Im trying to not to carry a json file wherever I take my script. I get the following error when I tried to pass a dictionary instead of a json file on the fo...
Alvaro Lamadrid
1

votes
1

answer
204

Views

Adding rows on a spreadsheet exceeds 100 sec user quota

I am writing a script in Python to add rows into a spreadsheet using gspread. client = gspread.authorize(creds) ws = client.open('my spreadsheet').sheet1 ... for xml in for xml in soup.findAll('items'): item = { ... } ws.append_row(item) This work until I reach around 100 items and then it gives me...
r.yaz
1

votes
1

answer
22

Views

Python GSpead On-Change Listener?

I'm making a script that checks a google sheet from a google form and returns the result as a live-feed visualization of a poll. I need to figure out how to update the value counts, but only when the google sheet is updated, as opposed to checking every 60 seconds (or something). Here is my current...
Davis Keene
1

votes
0

answer
94

Views

Accessing an organization-restriced Google Sheet via API

I am writing a Python 3.7 script that needs to read data from a Google Spreadsheet. The spreadsheet in question belongs to an Organization that my work Google Account is part of: let's just call it 'Organization'. The spreadsheet permissions are set as 'Anyone at Organization with the link can view'...
alexdma
1

votes
0

answer
32

Views

Output line by line

I've been researching my question, but I have not found it. So I decided to write. In my script, after manipulating some data, I get the correct values ​​in their proper cells (A full column. Eg I need to export all values of column F). The code I use to do this: lis = wks.col_values ​​('91'...
Vini
1

votes
0

answer
30

Views

How to implement Refresh Token in Service Account

I am a student currently doing a digital sign in page as a project. I'm relatively new to Python but I need help with implementing a refresh token because after the sign in page has been open for an hour, it stops uploading entries to the Google sheet it's supposed to update with a log. Here's the g...
Max Pinckney
1

votes
0

answer
40

Views

Is there a mechanism to trigger a Python script to update the google spreadsheet?

I am using gspread library in Python to write the data to a google spreadsheet. The data which is being written in the spreadsheet changes every day. So, my question is that is there a way to set some kind of trigger on the Google Spreadsheet which can call Python script to get the new data and upda...
Rishabh Mishra
1

votes
0

answer
70

Views

ModuleNotFoundError: No module named 'gspread'

I have an issue with the gspread module, and I think with Python 3 too. My code is something like that: import blabla, gspread, etc... And if I try to run it python3 myscript.py every module seems to run fine, except gspread. I receive this error: Traceback (most recent call last): File 'z_schedule....
rRexee
1

votes
1

answer
32

Views

gspread (Read google Sheet in pandas) [closed]

I am new to python programming. I need to read a google sheet in python so that I can manipulate the sheet with python(pandas). How we can do?
Arvind Pant
1

votes
1

answer
42

Views

How can I use gspread in Python3 to print the value of an xpath in the left cell next to a corresponding URL?

My intent is to scrape the value of an xpath from a range of URLs, found in the fourth column of a Google Sheet, and to print that value in the cell to the left of the URL. I have the below so far, but when I run this, it prints the last value of the adGroupStatus list for all URLs, rather than the...
Stu
1

votes
0

answer
17

Views

Resolving MultiIndex error regarding dtype being an object

When trying to upload a pivoted dataframe to google sheets using google drive api i'm being prompted with the following error: TypeError: Setting class 'pandas.core.indexes.multi.MultiIndex' dtype to anything other than object is not supported Upon checking with dtypes i've seen that my index value...
George C. Serban
1

votes
1

answer
1k

Views

gspread writing data on google spreadsheet gives error on live database

I have used the gspread for writing the data on Google spreadsheet. Its working fine locally but when I was trying at live server it gives me a following error. File '/home/openerp10/openerp_7.0/addons/spreadsheet_calculate_all/spreadsheet_calculate_all.py', line 53, in insert a = c.open(title).shee...
Bhavesh Odedra
1

votes
1

answer
1.8k

Views

python gspread authorize oauth2 credentials

How can i make gspread use my oauth credentials? I having error for http response gspread.httpsession.HTTPError :( can anyone tell me what's wrong with my code? import datetime import gspread import json import MySQLdb from oauth2client.client import OAuth2Credentials # Get access token from databas...
inferno
1

votes
3

answer
1.4k

Views

Issues using OAuth2 to authorize in gspread using python

I am very new with python so please excuse my ignorance. I am trying to send data to Google spreadsheets and have decided to use gspread. However gspread requires me to use OAuth-2.0 to authorize access to the spreadsheets. I have used the tutorial on their documentation page to do so. However when...
user3120921
1

votes
1

answer
723

Views

gspread/OAuth2: authenticated default gmail account (used early in ClientLogin)

I have been using gspread (authenticated via ClientLogin) for a last year. Now I would like to use OAuth2. I've followed tutorial from gspread site: http://gspread.readthedocs.org/en/latest/oauth2.html The problem is that this method creates new 'Email address' (in console.developers.google) which d...
TomCod
1

votes
1

answer
339

Views

gspread gives TypeError: expected bytes when trying to log in

I'm trying to use Google Spreadsheets OAuth with the gspread library. I get a TypeError: expected bytes, not str exception when sending credentials. How do I fix this? import gspread import json from oauth2client.client import SignedJwtAssertionCredentials json_key = json.load(open('Test for gspre...
Jon Bresler
1

votes
1

answer
1.9k

Views

CryptoUnavailableError: No crypto library available (using oauth2client in google app engine)

I am using gspread to connect my application to spreadsheet and for that I am using the following code import json import gspread from oauth2client.client import SignedJwtAssertionCredentials json_key = json.load(open('service_account.json')) scope = ['https://spreadsheets.google.com/feeds'] crede...
rhemon19
1

votes
1

answer
75

Views

Pulling Data from a Live Google Sheet and Emailing It

I need to pull both a username and an extension from a Google sheet and then email it to the users once a week. I've written an extremely inelegant solution that I will attach below. I'm certain it can be reduced substantially with a well-written loop and some logic. I'd appreciate any nudge in the...
mpoggy
1

votes
2

answer
2k

Views

gspread.exceptions.SpreadsheetNotFound

I am writing a python(ver 3) script to access google doc using gspread. 1) import gspread 2) from oauth2client.service_account import ServiceAccountCredentials 3) scope = ['https://spreadsheets.google.com/feeds'] 4) credentials = ServiceAccountCredentials.from_json_keyfile_name(r'/path/to/jason...
TestIsFun
1

votes
2

answer
314

Views

Gspread - Change Listener?

I currently run a daemon thread that grabs all cell values, calculates if there's a change, and then writes out dependent cells in a loop, ie: def f(): while not event.is_set(): update() event.wait(15) Thread(target=f).start() This works, but the looped get-all calls are significant I/O. Rather than...
PattimusPrime
1

votes
1

answer
155

Views

Gspread - Can Not Retrieve Spreadsheets

I am trying to use Gspread in Python2.7 to retrieve spreadsheets. I seem to be able to login but whenever I issue the command gc.openall() it just returns an empty list. I have given the service account admin access to everything and the sheets api is enabled in my google console. Can anyone point o...
user2694306
1

votes
1

answer
298

Views

How to make a a google sheets spreadsheet available to gspread

I'm working through the documentation to gspread (http://gspread.readthedocs.io/en/latest/oauth2.html ), and have been able to get the introductory code block working: import gspread gc = gspread.authorize(credentials) However when I run the following script : import gspread from oauth2client.servic...
user61629
1

votes
1

answer
192

Views

Gspread multiple range update

I want to update multiple columns in one call. I know its possible with: # Select a range cell_list = worksheet.range('C1:C7') for cell in cell_list: cell.value = 'O_o' # Update in batch worksheet.update_cells(cell_list) But I want to update few columns, so range would be 'C1:C7;'E1:E7';'K1:K7' How...
Devis Merrit
1

votes
1

answer
53

Views

google sheets gspread listener on google sheets push button

We have a python script that uses gspread to execute an import mechanism from a Google Sheets worksheet into the next system. This is a command-line interface where the script is given the worksheet id, then connects to the Google Sheet, parses the data and imports it to the next system. We would li...
719016
1

votes
2

answer
121

Views

raspberry pi python gspread OAuth 2 error

I have a script which should append a row in google spreedsheet every 2 minutes. When i start the script it works well but after a some time I get following error: { 'error': { 'code': 401, 'message': 'Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or oth...
KT Works
1

votes
1

answer
486

Views

Read cell format from Google sheet using Python (API v4)

I'm looking for a way to read a cell's formatting from a Google sheet in Python, specifically, its background colour. Two popular packages I've found to be able to read a sheet are gspread (fork) and pygsheets. I tried both and they work well in reading my sheet data, however from what I can see nei...
Sidewinder
1

votes
1

answer
261

Views

Read Google Sheets From Python

I am working on a data Migration tool. I have add a functionality wherein a user can pull data from Google sheets. The current approach that i have followed is by first generating credentials.json file from console.developers.google.com and used gspread library. So, whenever a user will have to pul...
ankit
1

votes
2

answer
60

Views

How to integrate gspread with aiohttp

I am trying to use gspread, but I need the library to mesh well with another async library I am using. After digging through the docs for gspread, I found this function that I can use: class gspread.Client(auth, session=None) An instance of this class communicates with Google API. Parameters: aut...
Will Miller
1

votes
1

answer
0

Views

Python Selenium : TypeError: list indices must be integers or slices, not WebElement

Hello I'm trying to perform a for loop for different elements tr, each of them with td with information to extract, when I do the loop, It return me the error: TypeError: list indices must be integers or slices, not WebElement lines = driver.find_elements_by_xpath('//[@id='DataTables_Table_0']/tbody...
Rafa Romero
1

votes
2

answer
140

Views

while loop incrementing range in django

I am using gspread library to read cell values from Google spreadsheets. I want to loop over the range like: col_index=3 i=0 while i
Aman Gupta
1

votes
1

answer
622

Views

gspread update multiple cells not in range

In my application I have a bunch of cells not in range. Currently I am updating them one by one but it takes a lot of time. I would like to update them in batch by making just one call. I looked at a few other SO threads such as this, but in my case the cells are not in range. To simplify here is...
apadana
1

votes
1

answer
924

Views

How to copy a formula from one gsheet to another using python?

I'm not sure if this is possible. I have tons of spreadsheet, and the formulas need to be updated. How do I copy a formula from one cell or a group of cells to another? I've used gspread and it seems it can only do values. I need python to basically paste formulas on hundreds of sheets for me, witho...
jason

View additional questions