Opens an existing spreadsheet from its full URL.
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
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.
Snippets using this method
- Onboarding Scheduler
- Form Automations: Close Multiple Forms When Over Limit
- How do I reference a different spreadsheet in Apps Script?
- Create New Worksheet When Google Form Submitted
- Close Form After Certain Number of Responses
- Automatically Copy Spreadsheet Tab to New File with Values Only, No Formulas
Explore
Related methods
-
.openById()
Opens an existing spreadsheet using its Drive file ID.
-
.getActiveSpreadsheet()
Returns the spreadsheet the user currently has open.
-
.create()
Creates a new blank spreadsheet file in Drive.
-
.showModalDialog()
Opens a modal dialog that blocks interaction with the sheet.
-
.activate()
Makes a sheet or range the active selection.
More Apps Script
Better Sheets tutorials
Automatically Copy Spreadsheet Tab to New File with Values Only, No Formulas
Close Form After Certain Number of Responses
Create New Worksheet When Google Form Submitted
Form Automations: Close Multiple Forms When Over Limit
How do I reference a different spreadsheet in Apps Script?
Onboarding Scheduler
Related blog posts
Written guides about SpreadsheetApp.openByUrl().
How to Use Google Sheets as a Website Database
Did you know you can use Google Apps Script to turn a Google Sheet into a free, auto-syncing database for your website? This guide shows you exactly how to set it up. You’ll prepare your spreadsheet, write a few lines of code and publish your site. Don’t worry if you’re not a developer, we’ll walk you through it. Why Use Google Sheets as a Database? For small projects, Google Sheets offers many advantages over traditional databases: * Free hosting and storage * Easy to edit data without...
Read post →How to reference a different Google Spreadsheet in Apps Script?
Transferring Data Between Cells in Different Spreadsheets
Read post →Extract URLs from Google Sheets
Extract url from hyperlink google sheets.Skip the Command K. This Google Sheet tutorial will make it easier for you to extract URLS from Google Sheets.
Read post →