gspread

Python - problems accessing a Google spreadsheet using an OAuth 2.0 service client

天大地大妈咪最大 提交于 2019-12-14 03:12:19
问题 I own a Google spreadsheet which I am trying to access via a little OAuth 2.0 Python service client I am writing, using gspread and oauth2client . I've created an OAuth 2.0 service account on Google Developers Console and have shared the spreadsheet with that email, giving the client/application access to it, and have put the JSON key file containing the credentials inside a little test script. Although I am able to construct the OAuth 2.0 credentials object and even get a spreadsheet client,

Adding rows on a spreadsheet exceeds 100 sec user quota

微笑、不失礼 提交于 2019-12-13 02:44:05
问题 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 an error "error": { "code": 429, "message": "Insufficient tokens for quota 'WriteGroup' and limit 'USER-100s' of service 'sheets.googleapis.com' for consumer 'project_number:644051582230'.",

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

隐身守侯 提交于 2019-12-13 00:47:39
问题 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 doesn't have an access to spreadsheets - all spreadsheets should be shared again. This is really difficult if you have 1000+ spreadsheets. The question is: how to authenticated with OAuth2 my

How to get python gspread to use a SOCKS proxy server for connections?

谁说胖子不能爱 提交于 2019-12-12 02:07:54
问题 How could I get my script that's using gspread to have the gspread connections to google's servers use a SOCKS proxy? 回答1: SocksiPy should work for this, as per the SO question: How can I use a SOCKS 4/5 proxy with urllib2?. import socks import socket socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, "127.0.0.1", 8080) socket.socket = socks.socksocket import gspread # do whatever If this is not the desired result, you may have to create a custom instance of the bundled HTTPSession object. 来源:

gspread.exception Spreadsheet not Found on a particular sheet

有些话、适合烂在心里 提交于 2019-12-11 16:57:51
问题 I am working to get google sheets downloaded on my EC2 linux server.I shared the google sheet with email id from credentials json file. I am using gspread, to open the sheet using open_by_key(file['id']) and the code works when I run using root but not using a different user having the same properties. It gives this error : File "/home/edh/.local/lib/python2.7/site-packages/gspread/client.py", line 113, in open_by_key raise SpreadsheetNotFound gspread.exceptions.SpreadsheetNotFound This code

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

对着背影说爱祢 提交于 2019-12-11 08:56:43
问题 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, without me opening each individually and copy and pasting the formulas. Does anybody have a generic solution for copying and pasting formulas? This is pretty important, you would think someone can do it

col_count in gspread provides the total number of columns even though they have no data

余生长醉 提交于 2019-12-11 08:43:55
问题 When I use col_count in gspread I get the total number of columns of the Google sheet, even though only three columns contain data, also with the rows. It would be more useful if I could get the number of columns and rows with data. Is there a way to do that? 回答1: That's seems a problem for me also. But for me these works nicely gc=gspread.authorize(cred) sh=gc.open('test').sheet1 a=len(sh.row_values(1)) print('column count',end=' ') print(a) 回答2: The functions of row_count and col_count will

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

不羁的心 提交于 2019-12-11 02:42:08
问题 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 cell in cell_list: cell.value = G_SHEETS_ROW_SUM_COMMAND When my spreadsheet is populated, however, my command is prefixed with an apostrophe (presumably to keep the cell from being interpreted as a

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

一个人想着一个人 提交于 2019-12-10 19:57:05
问题 By using GSpread I have a range of cell's returned from a google spreadsheet that has all its elements something like this: <Cell R1C1 'Sandero'> 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 I can get it in (1,1) format (maybe by using a dictionary?) You see I need the address as well because I will later declare a graph with these values. I'm using Python 2.7 and

How to get the Worksheet ID from a Google Spreadsheet with python?

故事扮演 提交于 2019-12-09 11:37:29
问题 I'd like to identify a method to attain the Worksheet ID within the URL for each of the worksheets within a Google Spreadsheet Workbook. For example, the worksheet id for 'sheet2' of this workbook is '1244369280' , since it's url is https://docs.google.com/spreadsheets/d/1yd8qTYjRns4_OT8PbsZzH0zajvzguKS79dq6j--hnTs/edit#gid=1244369280 One method I've found is to pull the XML of a Google Spreadsheet, since according to this question, the only way to get the Worksheet ID is to stream down the