Questions tagged [pygsheets]

A python library to access Google Spreadsheets through the Google Sheets API. Use this tag to ask questions about pygsheets usage and errors

pygsheets is a python library to access Google Spreadsheets through the Google Sheets API (currently API v4). Use this tag to ask questions about pygsheets usage and errors.

Github for the package: https://github.com/nithinmurali/pygsheets

Full package documentation: https://pygsheets.readthedocs.io/en/stable/

167 questions
2
votes
1 answer

How do you create a new sheet in a specific folder/directory using PyGSheets v2?

I want to use PyGSheets to create a Spreadsheet in my Google Drive folder. I also want to be able to set the directory/folder where the sheet is created using the code. Specifically, I would like to type a string similar to a URL or even just the…
Joachim Rives
  • 471
  • 6
  • 19
2
votes
1 answer

pygsheets importing csv into worksheet

Having trouble getting pygsheets to accept the list format for reading CSV's import pygsheets import csv gc = pygsheets.authorize(service_file=service_account_file) # Open spreadsheet sh = gc.open_by_key(spreadsheet_key) # Open Worksheet wks =…
itChi
  • 642
  • 6
  • 19
2
votes
0 answers

Updating entire google sheet workbook using pygsheets

This is my current code: df = pd.DataFrame(any_dictionary) sh = gc.open('test_workbook') try: # if sheet doesn't exist, create wks = sh.worksheet_by_title('Test') except: wks = sh.add_worksheet('Test') wks.set_dataframe(df,(1,1), fit=True,…
2
votes
2 answers

How to create a pygsheets worksheet without the default sheet1?

Is there a way to create a pygsheets worksheet without the default sheet1? Looking through the documentation didn't help, but googling seems to indicate that it's possible to eliminate sheet1 in excel, so presumably, it should be possible in…
boardrider
  • 5,882
  • 7
  • 49
  • 86
2
votes
1 answer

Python script doesn't work on Windows (but works on mac)

I run exactly the same script successfully on mac, but it fails on windows server 2012 r2. I wonder what can be a reason and what should i check? Here is a script: import pygsheets gc = pygsheets.authorize(service_file='credentials.json') Im…
user912830823
  • 1,179
  • 3
  • 14
  • 25
1
vote
1 answer

pygsheets does not modify Date Format

I'm trying to convert a date in a Google Spreadsheet column from 3/3/2023 to Friday March 3, 2023 with pygsheets. The following code: client = pygsheets.authorize(service_account_file="credentials.json") test_sheet =…
Ramy
  • 20,541
  • 41
  • 103
  • 153
1
vote
1 answer

Conditionally format cells in a google sheet using pygsheets

I am trying to learn how to conditionally format cells in a worksheet using pygsheets. The reason for this is to only allow the end user interacting with a google sheet to only be able to input values that are in the correct format. For example, how…
user4933
  • 1,485
  • 3
  • 24
  • 42
1
vote
1 answer

python Gsheet export limitation error "exportSizeLimitExceeded"

Trying to export a file from gsheet using python and I encountered this issue, may I know what I need to add on my script? { "error": { "errors": [ { "domain": "global", "reason": "exportSizeLimitExceeded", "message": "This file is…
rodskies
  • 119
  • 1
  • 11
1
vote
1 answer

Date as part of file name nming convention for Gsheet API exported xlsx file using python

May I know what function I need to add/replace on my python script, here's my issue I have exported xlsx file from gsheet API to my server and I need to add an generic filename with file name and date (ex. FILENAME20211107.xlsx) here's my code: …
rodskies
  • 119
  • 1
  • 11
1
vote
1 answer

How to colorize the cell in column? Pandas, pygsheets

I got dataframe with 3 columns : sku/price_1/price_2 How to color a cell in price_2 if it is less than in price_1? what i already tried: def highlight_late(s): color = ['background-color: red' if s['price_2'] < s['price_1'] else …
1
vote
1 answer

How to use previous row value for vertically merged cells in google sheets while fetching using pygsheets?

I am trying to get the data in the merged cell Level 1 in all the smallest rows, or iterate over the rows created by the merged cells. I am getting [['Level 1', 'Level 2', 'Level 3'], ['', '', 'Level 3'], ['', '', 'Level 3']] when I am fetching…
codehia
  • 124
  • 2
  • 4
  • 16
1
vote
1 answer

GSheet wrap strategy in pygsheet

In the Pygsheet reference doc here it shows a wrap_strategy property. wrap_strategy How to wrap text in this cell. Possible wrap strategies: ‘OVERFLOW_CELL’, ‘LEGACY_WRAP’, ‘CLIP’, ‘WRAP’. Reference: api docs But in actual code if I were to…
Luigi
  • 439
  • 5
  • 23
1
vote
0 answers

Error occur of using pyinstaller and pygsheet,, help to find solution

I'm trying to create an exe file to distribute among users in my company. the exe file open a simple GUI (made with Tkinter), which allows the user to select a txt file from their pc and inserts the data from the txt into a Google sheet. I tested my…
1
vote
0 answers

AWS Lambda Python Function with pygsheets causing [Errno 97] Address family not supported by protocol

I am using python and the serverless framework to deploy functions to AWS Lambda. I have been running into an issue when I want to run a SQL query and then output the results into a google sheet. My code functions perfectly locally, but not on AWS…
1
vote
2 answers

AWS Lambda and Pygsheets

This is slightly related to this previous question . Similar to that time, I am trying to use pygsheets on AWS Lambda and I'm having trouble with the json file. Like what he discussed, the json file is included in the zip. What I'm having trouble…
cpuser
  • 37
  • 7
1
2
3
11 12