Questions tagged [gspread]

1

votes
3

answer
695

Views

Inserting a list of list in python to google sheets using gspread

I have created a nested list in python which looks like my_list = [[a,b],[c,d],[e,f],[g,h].....] What I want to do is insert this list as a batch so that each element gets inserted in a new row in the google sheet. This list is generated from an user input and therefore the number of elements in my_...
Sameera
1

votes
1

answer
196

Views

Update Googlesheet cell with timestamp from Python

I'm attempting to update a cell in a google sheet with the current date/time of my machine using python 3.6.5. I'm using gspread to connect to the google sheet. If I do the following it will give the date/time that I'm looking to put into google sheets: import datetime print(datetime.datetime.now(...
C.Felix
0

votes
0

answer
7

Views

buildozer - kivy+gspread+oauth2client app crashes on start

After installing modules, I followed instructions to build an apk file. My app uses gspread and oauth2client. Put all the requirements in the buildozer.spec file. I run buildozer android debug deploy run logcat then the application crash after loading screen. The first thing I think the problem is...
DrCreampuff
2

votes
0

answer
11

Views

How to pass list to google spreadsheet

Trying to get the values of the list into a spreadsheet, but it only seems to be printing when i place it as a string( meal = str(meal())). OTHERWISE GETTING an error, gspread.exceptions.APIError: { "error": { "code": 400, "message": "Invalid values[10][0]: list_value {\n values {\n string_valu...
FirmCiti Inc
3

votes
1

answer
1.5k

Views

Sharing Google sheet with service account email

I wrote a script to connect to a Google spreadsheet and load data into a postgresql database from it. I already created a service account and obtained the necessary credentials for it in a .json format,the problem is when I try to share the google sheet with my service account email, I receive an em...
johan855
1

votes
3

answer
1.8k

Views

Accessing Google Drive Spreadsheets with Python Gspread

I just started using Gspread and am trying to access one of my google docs spreadsheets in my google drive. I followed the instructions and went to Google API console and created a JSON file. When I run this code I get no errors: import gspread import json from oauth2client.client import SignedJwtAs...
Michael
5

votes
1

answer
2.1k

Views

python gspread google spreadsheet keeping connection alive

I'm updating my spreadsheets using gspread, the process takes about an hour, i have about 200 spreadsheets. It seems about 30 minutes into the updating the sheets, the connection drops. Is there a way to keep the login alive? I thought I was keeping the connection alive because I'm opening and writi...
jason
1

votes
1

answer
366

Views

Updating cell values with formulas results in apostrophe prefixes with Sheets API

Right now, I'm using gspread and the Google Sheets API to update cell values, setting cell.value equal to a string of a specific formula. Example code: # Calculates sum of cells in current row from column B to H G_SHEETS_ROW_SUM_COMMAND = '''=SUM(INDIRECT(CONCATENATE("B",ROW(),":H",ROW())))''' for c...
lvkv
1

votes
2

answer
1.9k

Views

Populating google spreadsheet by row, not by cell

I have a spreadsheet whose values I want to populate with values from dictionaries within a list. I wrote a for loop that updates cell by cell, but it is too slow and I get the gspread.httpsession.HTTPError often. I am trying to write a loop to update row by row. Thats what I have: lstdic=[ {'Amount...
Koba
2

votes
2

answer
305

Views

Get_all_values from Google Spreadsheet

I am having an issue with Gspread's get_all_values() import json import gspread from oauth2client.client import SignedJwtAssertionCredentials from gmail_variables import * json_key = json.load(open('key7367.json')) scope = ['https://spreadsheets.google.com/feeds'] credentials = SignedJwtAssertionCre...
jaysig
2

votes
1

answer
820

Views

CryptoUnavailableError: No crypto library available and from oauth2client import crypt failure.

The error is in gspread authentication. Got oauth2client.client.CryptoUnavailableError: No crypto library available I have installed both pyOpenSSL and pycrypto. With the Crypto folder obtained after installation of pycrypto in my app directory. I dug deeper on why the above error still persists. I...
Prajapathy3165
2

votes
1

answer
1.2k

Views

Gspread export spreadsheet to filesystem with formatting

I need to download the Google spreadsheets on filesystem, I am using Gspread to read the files from Google Drive which works fine. I tried exporting to CSV but this ofcourse discards the formatting. json_key = json.load(open('/googleDriveCredentials.json')) scope = ['https://spreadsheets.google.com/...
mahaDev
1

votes
2

answer
252

Views

Modified tweepy stream class

I have a project to practice my Python skills: To extract some tweets coordinates with Tweepy Stream To put them into a Google spreadsheet Then use the Google spreadsheet to create a map in CartoDB I am already able to do all these things independently. Now, the challenge is to make everything work...
Nael
5

votes
5

answer
12.7k

Views

How to write a python script to manipulate google spreadsheet data

I am able to get the feed from the spreadsheet and worksheet ID. I want to capture the data from each cell. i.e, I am able to get the feed from the worksheet. Now I need to get data(string type?) from each of the cells to make a comparison and for input. How exactly can I do that?
GeminiDNK
2

votes
2

answer
1.5k

Views

gspread or such: help me get cell coordinates (not value)

By using GSpread I have a range of cell's returned from a google spreadsheet that has all its elements something like this: I know how to get from here the cell value: cell.value but I would also like to get the address (R1C1 in this case) separately. It would have to be (R1,C1) or even better if...
Laci
5

votes
2

answer
4.3k

Views

Appending pandas Data Frame to Google spreadsheet

Case: My script returns a data frame that needs has to be appended to an existing google spreadsheet as new rows of data.As of now, I'm appending a data frame as multiple single rows through gspread. My Code: import gspread import pandas as pd df = pd.DataFrame() # After some processing a non-empty...
BALAJI
2

votes
1

answer
305

Views

gspread get_all_records not returning values for some columns

I'm reading a spreadsheet populated from a form. When I retrieve the data using get_all_records, one of the columns doesn't return values. However, when I use get_all_values, the values are there. wks = gc.open_by_key('blahblahblah') worksheet = wks.worksheet('working') data2 = worksheet.get_all_rec...
sophia
2

votes
1

answer
337

Views

Is there a way to use gspread to select all the cells that have content?

I have a google worksheet that is constantly being added to via a google form. I am trying to use gspread to take the content provided by the form and transfer it to a separate spreadsheet. The problem I have run into is selecting all the cells that have content, as in they are non-blank. Ideally I...
Michael
3

votes
3

answer
2.4k

Views

gspread update cells in batch, 50k limit?

I have been using gspread with no problem for a while. I recently went over 50000 cells when updating to Google sheets. I'm getting a File "build\bdist.win32\egg\gspread\httpsession.py", line 81, in request raise HTTPError(response) HTTPError Did it take so long to update that the connection timed...
jason
4

votes
3

answer
1.2k

Views

Using OAuth and gdata to copy google spreadsheet

I am working with gspread to modify existing Google spreadsheets and would like to make a copy of an existing one. Unfortunately, gspread doesn't support this, but it can be done with gdata (as described in this thread): import gdata.docs.client docs_client = gdata.docs.client.DocsClient() docs_clie...
nicole
3

votes
1

answer
1.2k

Views

Persistent SpreadsheetNotFound errors on specific Google Sheets spreadsheets in gspread for Python

I am using gspread to collect data from several hundred Google Sheets spreadsheets. I parse the files stored by Google Drive in a local directory and obtain the URLs for all the spreadsheets within a specified folder. Then I use a python wrapper to go through the URLs and a shell script wrapper to j...
user1644030
2

votes
1

answer
3.9k

Views

google spreadsheets gspread append_row issue

I'm working on a program that generates a dynamic google spreadsheet report. Sometimes when I create a new row (with data) in google spreadsheet using gspread append_row function it doesn't work as expected and no exception is thrown. The new line is added but there is no data inside. example code b...
Lior Mizrahi
3

votes
1

answer
1.6k

Views

creating a worksheet using gspread

I am new to python. I was just trying to create a google worksheet using gspread. I read about using google api's from here. I downloaded credentials from Google Developers Console which is a file in json format. Then I used this code import gspread from oauth2client.service_account import ServiceAc...
Vivek Puri
3

votes
1

answer
437

Views

Retrieve value of links from Google Sheet?

I have some values in a Google Sheet, some of which are hyperlinked, like the third one here: I want to retrieve the text value of each cell, and the hyperlink if present. I am able to access the sheet easily enough with gspread: import gspread from oauth2client.service_account import ServiceAccoun...
Richard
1

votes
2

answer
801

Views

python gspread newbie google spreadsheet

I have been able to successfully connect to gspread with the appropriate credentials but when I try to open an existig file (in my google account) it fails. I have tried open() as well as open_by_key(). I am assuming that my account is different than the service account I just created but I don't s...
jordanthompson
2

votes
1

answer
87

Views

gspread HTTPError: 400 using insert_row OR add_row

my first SO question so I hope that I don't anger the group ;-) Using gspread 0.4.0 and Python 2.7, I can access pages in my Google Sheet, can read data, and can change the content of cells using update_cell(). However, attempts to insert a row or append a row to the end of the sheet are both met w...
steve
3

votes
1

answer
369

Views

Cant import gspread when using python 3.4.3

I downloaded gspread the other day using pip. I manage to import it into a python file and run the file when using python 2.7.6 but when using python 3.4.3 it returns error no module named gspread. I did see that when I go to where gspread is installed its under 2.7.6 meanwhile I have discord api un...
Martin Björn
2

votes
0

answer
212

Views

Python gspread and Oauth2 for server-side applications returns no spreadsheets

I'm trying to read a bunch of spreadsheets within my organization that have been shared with my account and import the records into a database. I'd like to use OAuth2.0 instead of just using raw text passwords, but I'm having trouble getting this to work. My code right now is this: scope = ['https:/...
jpavs
2

votes
0

answer
226

Views

incompleteread error: I'm trying to read a spread sheet using gspread

I'm using get_all_values() function which some times throws an error content = worksheet.get_all_values() File "/usr/local/lib/python2.7/dist-packages/gspread/models.py", line 339, in get_all_values cells = self._fetch_cells() File "/usr/local/lib/python2.7/dist-packages/gspread/models.py", line 22...
ck reddy
1

votes
1

answer
1.6k

Views

python gspread library only writes to worksheet labeled 'sheet1'

My sheet is named 'doc_name', and it has two worksheets, 'sheet1' and 'sheet2'. but, i can only write data to the worksheet labeled 'sheet1'? is this a limitation or am i doing something wrong? this works, wks = gc.open("doc_name").sheet1 but this fails, wks = gc.open("doc_name").sheet2 giving this...
user3768071
2

votes
1

answer
44

Views

gspread get key once opened by title

how do I get the key of the workbook if I know only the name of the workbook? I can use open by title, but once i'm in I didn't find a get.key type method in the documents. Is there a way to get the key by only knowing the title?
jason
7

votes
3

answer
2.8k

Views

gspread authentication throwing insufficient permission

Using developers.google.com we created api user and downloaded credentials as json file. Now On my macbook gspread authentication is working fine while using credentials.json. when moved same config to linux server on aws its giving 403 insufficient permission error. Pip and python version are same...
Ahsan Naseem
5

votes
2

answer
9k

Views

Correctly installing pyOpenSSL for Python (Windows)

I'm trying to make an application that automatically updates a Google Plus spreadsheet. In order to do this I had to set up gspread, which also requires pyOpenSSL in order to work. Without it, it throws this error: CryptoUnavailableError: No crypto library available Using pip, I type the command: pi...
Constantly Confused
2

votes
1

answer
642

Views

gspread populate google spreadsheet from python no attribute 'update_acell'

I'm stuckle all morning to fill a cell in a google spreadsheet from a python script. After running through a couple of out-dated tutorials I can open the spreadsheet, using this script import gspread from oauth2client.service_account import ServiceAccountCredentials scope = ['https://spreadsheets.g...
Richard
2

votes
1

answer
289

Views

Gspread keep alive after update google auth2

There are several examples for 'keep the connection with google spreadsheet alive' But all I found are based on the 'old' Google Sign-In system which isn't work anymore since april 2015 What is the proper methode to keep the connection with googlespreadsheet alive using OAuth 2.0 I've Tried this i...
Richard
2

votes
2

answer
3.2k

Views

oauth2client.client.CryptoUnavailableError: No crypto library available

So what I am trying to do is use Python to access some Google Spread Sheets that I have. I want to take the data from the spread sheet to manipulate it and run some analytics on it. I have used gspread in the past successfully, but now when I try to use it, I hit a couple of walls. When I run the fo...
Thomas
2

votes
0

answer
220

Views

Using gspread results in Token invalid - AuthSub token has wrong scope

Trying to access my spreadsheet under my organizational account. I have run the Google API Python Client Quickstart and substituted the appropriate pieces to use my spreadsheet and everything worked. When I change things up to use gspread I receive a Token invalid - AuthSub token has wrong scope....
Eric
2

votes
1

answer
581

Views

How to solve Gspread oauth refresher token error?

I have a gspread Python script which has been working perfectly for 6 months. Now suddenly I'm receiving an error when trying to authorize my service account credentials. Here is the error: raise HttpAccessTokenRefreshError(error_msg, status=resp.status) oauth2client.client.HttpAccessTokenRefreshEr...
R001W
5

votes
0

answer
329

Views

Does the Google Spreadsheet Python API or gspread allow images or rich text?

Is it possible with gspread or other Python-based access to Google Spreadsheets to insert an image into a spreadsheet? Also, is it possible to make rich text cells (e.g., bold, italic, different fontsize, colors, etc.)?
dslack
2

votes
2

answer
829

Views

How to write a table (list of lists) to Google Spreadsheet using gspread

I have a table which is presented as Python's list of lists and I'd like to write it down to some Google Spreadsheet using gspread library. However, it seems that gspread does not have such function out of the box. Of course I can use loop and update particular cells but it is very inefficient solut...
Ilya V. Schurov

View additional questions