I use Python and Gspread to create a gsheet with about 40 worksheet containing datas about accounts. On the first worksheet, I want to put something like a summary with a link to the account's worksheet with something like =LIEN_HYPERTEXTE("#gid=xxxxxxxxxxxx","Account_42") but for this i need the worksheet gid/url. I've tried things with gspread or with pygsheets but the only thing i get is the worksheet id.
Is there a simple way to get it ?
Thanks
If my understanding is correct, how about this answer? GID is the sheet ID of a sheet in a Spreadsheet. This is the same with the worksheet ID using at gspread.
In order to retrieve all worksheet IDs in a Spreadsheet, I think that the method of worksheets() can be used.
spreadsheetId = "###" # Please set the Spreadsheet Id.
client = gspread.authorize(credentials)
sh = client.open_by_key(spreadsheetId)
worksheet_list = sh.worksheets()
for sheet in worksheet_list:
print('sheetName: {}, sheetId(GID): {}'.format(sheet.title, sheet.id))
credentials.If I misunderstood your question and this was not the direction you want, I apologize.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With