Questions tagged [gspread]

gspread is an asynchronous Python library for interacting with Google Spreadsheets.

gspread is a Python library for interacting with Google Spreadsheets.

949 questions
4
votes
1 answer

Rounding a number in google sheets using gspread API

I am writing a pandas dataframe to google sheets using gspread: from gspread_formatting import * import gspread from df2gspread import df2gspread as d2g import pandas as pd d2g.upload(data, sheet.id, 'test_name', clean=True, credentials=creds,…
Jonas Palačionis
  • 4,591
  • 4
  • 22
  • 55
4
votes
2 answers

Is there a way to authenticate gspread with the default service account?

If I want to create/read/update spreadsheets using gspread, I know first have to authenticate like so: import gspread gc = gspread.service_account() Where I can also specify the filename to point to a service account json key, but is there a way I…
niczky12
  • 4,953
  • 1
  • 24
  • 34
4
votes
1 answer

How to fix the "google.auth.exceptions.RefreshError: ('No access token in response." when trying to open a spreadsheet using GoogleSheet API

I followed the video from TechWithTim step by step (https://www.youtube.com/watch?v=cnPlKLEGR7E) but I am still getting an error when I try to open the sheet. The code works fine until sheet = client.open("GuildTaxes").sheet1 line. Here is my…
Tirterra
  • 579
  • 2
  • 4
  • 14
4
votes
1 answer

Problem with data format while Importing pandas DF from python into google sheets using df2gsheets

I'm using df2gspread to import a certain pandas df into google sheets. The process runs without any issues, but the numeric information which I'd like to manipulate within Gsheets is imported as text. When I use basic math operations with the data…
4
votes
1 answer

Get link inside href tag from cell in Google Spreadsheet (gspread)

I am using the Python module gspread to try and extract a link inside an href tag from a cell of a Google spreadsheet. I have tried the following, and noted their problems: worksheet.acell ('B5').value: Gets cell text, not link inside href…
Chaithanya Krishna
  • 1,406
  • 1
  • 8
  • 13
4
votes
5 answers

How can I redo a try If I had an except?

I'm coding a scraper that uses gspread to read and write In Google Sheets. In the "writting" part of the code I had to add a try-except because of an APIError caused by the quota limit of writting, so when the except Is executed It have wait 100…
4
votes
1 answer

GSpread how to duplicate sheet

After googling and searching on Stackoveflow, I think I can't find a guide on how to duplicate existing sheet(existing Template sheet) and saving it into another sheet. as per docs, there is duplicate_sheet but I can't manage to do a working…
Led
  • 662
  • 1
  • 19
  • 41
4
votes
3 answers

How do you copy values from one spreadsheet to another using gspread or some other way?

(beginner) I'm attempting to copy values from one spreadsheet to another using python. I'm using gspread but I can't seem to figure out how to copy the values from my first spreadsheet to the other. How can I copy values from the first spreadsheet…
Jordan
  • 63
  • 2
  • 8
4
votes
1 answer

I get BrokenPipeError: [Errno 32] Broken pipe error in python

For the part of my code you can find below, sometimes I get the error in the title. Is it related with heavy data or poor internet connection maybe? I try to get 14k line from one google spreadsheet to another by using gspread. Is there any way to…
zeppelin11
  • 103
  • 2
  • 3
  • 9
4
votes
2 answers

Creating A Spreadsheet In A Folder With GSpread

I am having trouble finding any documentation on how to create a GSheet in a certain Google Drive directory using GSpread. I have checked the documentation and had a look around some of the back end code. I am currently using the code below to…
4
votes
1 answer

Is there a way to autofit a column in Google Sheets using gspread API for Python?

Is there a way to manipulate row with in Google Sheets using gspread API for Pyton? Autofit will be great but manually change size is ok too.
4
votes
1 answer

python gspread import csv to specific work sheet

Is there a straight forward way to import data from a CSV file to a specific work sheet using gspread? The default is always sheet1, as mentioned in the documentations. If there is none, what would be the most economical approach regarding "google…
Iddos
  • 127
  • 3
  • 9
4
votes
1 answer

Can I update cells without getting their current values first using gspread

I have a google sheet that I am inserting/updating the values of based on the results of some API calls I am making in a python script. Following the gspread documentation, I'm currently fetching the range from the sheet, then updating the values,…
Tayo Moore
  • 43
  • 4
4
votes
0 answers

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…
4
votes
1 answer

Python: Change: How do I make local variable global?

import gspread from oauth2client.service_account import ServiceAccountCredentials import pprint scope = ['https://spreadsheets.google.com/feeds', 'https://www.googleapis.com/auth/drive'] creds =…