I am receiving this warning, and I want to prepare in advance for this version update
[*] Updating Google sheet.../home/myname/.local/lib/python3.11/site-packages/gspread/worksheet.py:1046:
UserWarning: [Deprecated][in version 6.0.0]: method signature will change to: 'Worksheet.update(value = [[]], range_name=)' arguments 'range_name' and 'values' will swap, values will be mandatory of type: 'list(list(...))'
warnings.warn(
Done.
We are currently using gspread 5.10.0, here is function signature on our machine
myname@my-machine:~/ourdir-analytics/project$ python3.11
Python 3.11.0 (main, Aug 21 2023, 05:23:52) [GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import inspect
>>> from gspread import Worksheet # or wherever the update function is located
>>>
>>> sig = inspect.signature(Worksheet.update)
>>> print(sig)
(self, range_name, values=None, **kwargs)
>>>
I've tried the following, and have received the following errors
# a helper function to connect to spreadsheet
def get_sheets_tab(spreadsheet_name, worksheet_name):
print('[*] Accessing sheets account... ', flush=True, end='')
key_file = settings.SERVICE_ACCOUNT_FILE_LINUX if platform.system() == 'Linux' else settings.SERVICE_ACCOUNT_FILE_MAC
gc = gspread.service_account(key_file)
print('Done.', flush=True)
sheet = gc.open(spreadsheet_name) # have to grab tabs by index #, so bad...
tab = sheet.worksheet(worksheet_name)
return tab
calling update(), here is where the issue lies, with the named parameters
import gspread
tab = get_sheets_tab("our tools", "our sheet tab")
# try 1
tab.update(values = [output_df.columns.values.tolist()] + output_df.values.tolist())
# error 1 # TypeError: update got unexpected keyword arguments: ['values']
tab.update(value = [output_df.columns.values.tolist()] + output_df.values.tolist())
# error 2 # update got unexpected keyword arguments: ['value']
tab.update(range_name = 'A1', values = [output_df.columns.values.tolist()] + output_df.values.tolist())
# error 3 # update got unexpected keyword arguments: ['value', 'range_name']
`tab.update(values = [output_df.columns.values.tolist()] + output_df.values.tolist())` is throwing the error
# error 4 # update got unexpected keyword arguments: ['values', 'range_name']
This function works just fine if I remove all parameter names, however the whole purpose of what I am doing here is attempting to add the parameter names so that the warning won't be a problem in the future. What's going on here? Why can't I pass parameter names to this function?