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
1
vote
0 answers

Using pygsheets and searching for specific data and getting result, need output to include the cell location

Am working on inventory and, after searching for and locating a product by Mfg. Code, I need an output that prints the row data and location. No problem in getting the row data but don't know how to have both the data and locating output together.
1
vote
1 answer

How to access renamed google sheets

I have a google sheets workbook whose sheets get continuously re-ordered. I am able to read each sheet using wks = gc.open("DatSheet").sheet1, but this will always get data from the sheet in first position. How can i use individual sheet names to…
1
vote
3 answers

pygsheets - Load credentials from dict instead of file

Is it possible to load credentials from dict instead of file? This would make it easier to use short scripts in cloud functions, because then there is no need for uploading files. Normally authorization goes like this: import pygsheets gc =…
PythonSherpa
  • 2,560
  • 3
  • 19
  • 40
1
vote
1 answer

pygsheets last access or last modified timestamp

I'm looking for the most efficient method to check if & when Google Sheets have been modified using pygsheets. My current method: (Py): gc = pygsheets.authorize(service_file=gServiceAccAuthFile, retries=1) # Open spreadsheet sh =…
itChi
  • 642
  • 6
  • 19
1
vote
1 answer

How do I rotate text in a Google Sheet using pygsheets?

I'm trying to rotate the text of some long header names in a Google Sheet using pygsheets in python. The code below shows a slight modification of the examples provided in pygsheets which according to the docs should work. The text is written to…
1
vote
1 answer

How to identify the first empty column in a Google Sheet to append a dataframe using Python?

I want to append a dataframe to a Google sheet that already has some values. I want to identify the first empty column and append the dataframe there. Currently I'm pasting a dataframe to Google sheet using the code: import pygsheets gc =…
Pechi
  • 151
  • 1
  • 6
1
vote
0 answers

How to prevent convertation of float to string when importing Dataframe to Google Sheets?

I'm trying to send pandas DataFrame to Google Sheets with pygsheets. All values have defined data type. For example when I convert dataframe to_excel, excel reads floats as floats. But when i "send" dataframe with set_dataframe to Google Sheets they…
Archirk
  • 427
  • 7
  • 25
1
vote
2 answers

Error while uploading dataframe to google sheets using python?

I am fetching a google sheet as pandas dataframe, then adding a column in the df and then uploading it back. I am facing this error: Object of type 'int64' is not JSON serializable Below is the code: #reading and writing on google sheets gc =…
NK09
  • 195
  • 1
  • 12
1
vote
1 answer

'UnicodeEncodeError' when using 'set_dataframe'

When using set_dataframe to update my Google Sheets via pygsheets and pandas, I get error: UnicodeEncodeError: 'ascii' codec can't encode character u'\xf1' in position 13: ordinal not in range(128) This is due to utf-8 marks over some text, e.g.,:…
user3871
  • 12,432
  • 33
  • 128
  • 268
1
vote
1 answer

pygsheets data written to gsheets with formulaic chars takes data as formulas

When writing data to gsheets with pygsheets - one of my values contains a + char. e.g. +myvalue When then exporting the data, I get the #NAME? output, instead of the background value., of course the formula bar contains the right value. This is not…
itChi
  • 642
  • 6
  • 19
1
vote
1 answer

Is there a maximum number of named ranges in google sheet

I am writing a Python program to extract values from a google sheet and I am running into a weird problem whereby named ranges that I know I have put in to the sheet starts disappearing. When I re-enter them, some other range disappears. This has…
NiklasR
  • 473
  • 6
  • 19
1
vote
0 answers

updating a certain cell in pygsheet bot telegram - python

i am a new beginner in python, but my job forced me to use python. i created bot telegram that has function to store user's input in google sheet (pygsheet) and update a certain cell according to user's input (in my case update status of…
moji
  • 11
  • 2
1
vote
1 answer

Pygsheets - non-interactive oauth authentication

I'm attempting to use Apache Airflow and pygsheets to upload to various Team Drives. When using oauth authentication, because it's an Airflow task, there's no interactive terminal for inputting the authorization code returned by Google. I know that…
user584982
  • 25
  • 5
1
vote
1 answer

How to Authenticate Google Cloud Services on PyGSheets deployed in Web Server (Heroku)

Hi I want to use pygsheets to log events to my google spreadsheet. This will be scheduled thus deployed in a web server particularly Heroku. I am only using these lines to authenticate: import pygsheets gc = pygsheets.authorize() Running locally,…
Nikko
  • 1,410
  • 1
  • 22
  • 49
1
vote
1 answer

Way to pass exception and raise error if no exception returned

def create_spreadsheet_with_api(connection, filename): try: connection.open(filename) if (no exception): raise exception file already exists if (there exception): connection.create(filename) Using…
Rasul
  • 121
  • 2
  • 3
  • 7