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

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...
Close Form After Certain Number of Responses

Close Form After Certain Number of Responses

Create automatic triggers that close a form after a certain number of re...
Create New Worksheet When Google Form Submitted

Create New Worksheet When Google Form Submitted

Automate copying a template for new form submissions with user data inse...
Form Automations: Close Multiple Forms When Over Limit

Form Automations: Close Multiple Forms When Over Limit

Adding to the Form Automations: Allow User to Reopen form without Apps ...
How do I reference a different spreadsheet in Apps Script?

How do I reference a different spreadsheet in Apps Script?

I'll show you how to get text from one spreadsheet file to another with ...
Onboarding Scheduler

Onboarding Scheduler

I will guide you through the process of creating an onboarding scheduler...

Related blog posts

Written guides about SpreadsheetApp.openByUrl().

Browse the blog