Home > Enterprise >  How to get the sheets key of a google sheet into a cell in the sheet automatically?
How to get the sheets key of a google sheet into a cell in the sheet automatically?

Time:05-26

How to get the sheets key of a google sheet into a cell in the sheet automatically?

Now I am copying the key from the url, but I want the key to show up automatically in a cell in the sheet. Is it possible with a formula or apps script?

CodePudding user response:

For sheetID, put in a cell

=mySheetId()

after validating this script in your script editor

function mySheetId(){
  return SpreadsheetApp.getActiveSheet().getSheetId()
}

For spreadsheetID, put in a cell

=mySpreadsheetId()

after validating this script in your script editor

function mySpreadsheetId() {
  return SpreadsheetApp.getActiveSpreadsheet().getId();
}
  • Related