简体   繁体   中英

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?

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?

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();
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM