Returns the web link to open a file or folder.
class DriveApp method .getUrl()
DriveApp is the Apps Script service.
.getUrl() is the method name you will see after a dot in your code.
What it does
Why it's used
- Paste a clickable link back into the spreadsheet.
- Email someone the file link right after you create it.
Common errors
- Forgetting parentheses on getUrl. Write DriveApp.getUrl(), not DriveApp.getUrl or getUrl by itself.
- Skipping dots between chained calls. Each step needs a dot, like DriveApp.getFileById(id).getUrl().
- Adding spaces where they do not belong. Write DriveApp.getUrl(), not DriveApp .getUrl(), DriveApp.getUrl (), or DriveApp . getUrl().
- Wrong capitalization. Use DriveApp and getUrl, not driveapp or geturl.
Snippets using this method
Explore
Related methods
-
.getFileById()
Loads a Drive file by its file ID.
-
.addFile()
Moves a file into a folder.
-
.getFolderById()
Loads a Drive folder by its folder ID.
-
.getBlob()
Returns the file contents as a blob for reading or exporting.
-
.getRootFolder()
Returns the top-level My Drive folder.
More Apps Script
Better Sheets tutorials
Automatic Screenshots in Apps Script
Enter Google Drive File Name Get URL
Every Google Drive File Created in Last 24 Hours
Get Every Editor on Every Google File I Own
How To Download All Tabs as CSV in a Zip File
Take Screenshots from URLs in Google Sheets
Related blog posts
Written guides about DriveApp.getUrl().
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 →Automatic Weekly Backup of Google Sheets
How can we create backups of Google sheets every week or every day or every month?
Read post →