class SpreadsheetApp method .openByUrl()

SpreadsheetApp is the Apps Script service.

.openByUrl() is the method name you will see after a dot in your code.

What it does

Opens an existing spreadsheet from its full URL.

Why it's used

  • Open a sheet when you only have the share link, not the file ID.
  • Useful for scripts kicked off from a bookmark or emailed link.

Common errors

  • Forgetting parentheses on openByUrl. Write SpreadsheetApp.openByUrl(), not SpreadsheetApp.openByUrl or openByUrl by itself.
  • Skipping dots between chained calls. Each step needs a dot, like SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Data').openByUrl().
  • Adding spaces where they do not belong. Write SpreadsheetApp.openByUrl(), not SpreadsheetApp .openByUrl(), SpreadsheetApp.openByUrl (), or SpreadsheetApp . openByUrl().
  • Wrong capitalization. Use SpreadsheetApp and openByUrl, not spreadsheetapp or openbyurl.

Explore

Related methods

1 Better Sheets tutorials

Automatically Copy Spreadsheet Tab to New File with Values Only, No Formulas

Automatically Copy Spreadsheet Tab to New File with Values Only, No Formulas

Automatically copy a spreadsheet tab to a whole new spreadsheet file, ge...

Related blog posts

Written guides about SpreadsheetApp.openByUrl().

Browse the blog