Although the Google Sheet ID can be referenced in Apps Script with the following getSheetId()
, I find the need to extract the ID within a Google Sheets cell.
I have extracted the first part of the URL but not the ID. Using:
=REGEXEXTRACT(F2,"^(?:https?:\/\/)?(?:[^@\n]+@)?(?:www\.)?([^:\/\n]+)")
Luckily the URLs imported will always have the same format, so no need for a variable regex to handle different forms on the URL
Sheet URL
Sheet ID (always occurs after 5th forward slash and before the last forward slash)
1ZNU46cVFMebj8t-kFXySuZyTTTupCo8EMrHr1exXr6Zg
How can I specifically get the Google Sheet ID from the URL referenced in another cell?