Search code examples
python-3.xgoogle-sheetsgoogle-sheets-apigspread

How to get the document name of google spreadsheet?


I am trying to open a google spreadsheet using:

 import gspread
 sheet = gc.open_by_key(sheetkey)

after opening the sheet. I want get the name of document that was opened.


Solution

  • The title of the spreadsheet is stored as an object variable title. You can simply do sheet.title to get the title. Docs

    The same can be done for worksheets as well.