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

Upload CSV to Google Sheets using gspread

I have a Json object which needed to be uploaded to the Google Spreadsheet. I have searched and read various resources but could not find the solution. Is there a way to upload object or csv from locally to google spreadsheet using gspread. I will…
Salman Ahsan
  • 63
  • 2
  • 12
4
votes
2 answers

Close connection on gspread

I have a python script that gets information from a Google Spreedsheet using gspread. scope = ['https://spreadsheets.google.com/feeds'] creds = ServiceAccountCredentials.from_json_keyfile_name('client_secret.json', scope) …
Uniextra
  • 133
  • 3
  • 17
4
votes
3 answers

Get JSON data from POST in Django with REST Framework

I am attempting to build a REST API in Django for a Google Spreadsheet with Gspread, I'm running into a lot of issues (so if anyone happens to have a full example lying around, feel free to share... please? :)). One of those issues it that I'm…
Yannick
  • 446
  • 3
  • 6
  • 16
4
votes
3 answers

Update existing google sheet with a pandas data frame and gspread

I would like to update a particular tab in a Google Sheets document using a pandas data frame. I have reviewed the documentation on GitHub and readthedocs.io and am able to successfully update a certain range of cells using the following code:…
Mark Gilliland
  • 71
  • 1
  • 1
  • 4
4
votes
1 answer

Accessing google spreadsheet using shared link

I am building a python app where user can provide 'Anyone can edit' link to their spreadsheet and data can be read from there. I am using python's gspread module but it throws SpreadSheetNotFound error. import gspread from…
deffy50
  • 93
  • 7
4
votes
0 answers

Error importing gspread in iPython Notebook

So I have an iPython notebook setup in Pycharm and am getting the "ImportError: No module named gspread" error thrown when I run: import gspread I'm running this inside a virtualenv that I have verified in PyCharm is the one being used. I pip…
Evan Zamir
  • 8,059
  • 14
  • 56
  • 83
4
votes
3 answers

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…
norman
  • 5,128
  • 13
  • 44
  • 75
3
votes
1 answer

clear validated cells using a batch update using pygsheets

I have a pygsheets work sheet with cells that have been filled in and would like to clear the cells after pulling the data into python. My issue is that I have validated the cells with a particular data format then when I try to batch update the…
user4933
  • 1,485
  • 3
  • 24
  • 42
3
votes
1 answer

Copying and Pasting from one Google Sheet to another

I am relatively new to python and am struggling to figure out a way to copy and paste data from one google sheet to another using gspread. Does anyone know how to do this without using win32 to copy to an excel as a bridge?? Please see the code and…
3
votes
1 answer

Changing cell to number using gspread python API

I am writing a dataframe to a spreadsheet, I bold, change font, etc, but I can't change the format to be a number format: from gspread_formatting import * import gspread from df2gspread import df2gspread as d2g import pandas as pd d2g.upload(data,…
Jonas Palačionis
  • 4,591
  • 4
  • 22
  • 55
3
votes
2 answers

Python gspread Hyperlink adds '

I want to add a Hyperlink to a cell. I'm using the following code: cell_values = [1,'=HYPERLINK("' + some_url + '","' + some_text + '")',3] for i, val in enumerate(cell_values): cell_list[i].value = val worksheet.update_cells(cell_list) What is…
Tanne
  • 59
  • 7
3
votes
1 answer

Export data excel to google sheets with Python

Going through an itertuples, I need to export two data, located in two rows of an excel column ('G7', 'G8') to two columns of google sheets. How can I do this? import gspread from gspread_dataframe import get_as_dataframe, set_with_dataframe from…
Lino Costa
  • 67
  • 1
  • 8
3
votes
1 answer

Python - GSPREAD - Copy text and format from one google sheet to another one

I have two files in google drive (two google sheets) and I need to move from one file to another the data and the format in a regular mode. As you can see on the picture bellow, I have different text formats that I need to maintain (bold, text…
Pedro Alves
  • 1,004
  • 1
  • 21
  • 47
3
votes
2 answers

Check if workbook exists using gspread library?

How to check if workbook exists using gspread library? My problem is that if I run gspread.create(title) second time it does not rewrite the previous file but creates one more with the same name. Any aidea how to avoid it? Thanks. Petro.
PiterX
  • 39
  • 4
3
votes
1 answer

Is there an issue on python 3.8 with gsheet batch_update?

Following the following question and solution, how to reset all rows and column data uisng python gspread sheets, I have the following exact code requests = {"requests": [{"updateCells": {"range": {"sheetId": worksheet._properties['sheetId']},…
E_K
  • 2,159
  • 23
  • 39