Returns the file contents as a blob for reading or exporting.
class DriveApp method .getBlob()
DriveApp is the Apps Script service.
.getBlob() is the method name you will see after a dot in your code.
What it does
Why it's used
- Read file bytes to attach to an email or send to an API.
- Import CSV or image content into a sheet.
Common errors
- Forgetting parentheses on getBlob. Write DriveApp.getBlob(), not DriveApp.getBlob or getBlob by itself.
- Skipping dots between chained calls. Each step needs a dot, like DriveApp.getFileById(id).getBlob().
- Adding spaces where they do not belong. Write DriveApp.getBlob(), not DriveApp .getBlob(), DriveApp.getBlob (), or DriveApp . getBlob().
- Wrong capitalization. Use DriveApp and getBlob, not driveapp or getblob.
1 Snippets using this method
Explore
Related methods
-
.getFileById()
Loads a Drive file by its file ID.
-
.getUrl()
Returns the web link to open a file or folder.
-
.createFile()
Creates a new file in Drive from a name and content.
-
.addFile()
Moves a file into a folder.
-
.removeFile()
Removes a file from a folder without deleting it.
More Apps Script
1 Better Sheets tutorials
Automatic Screenshots in Apps Script
Related blog posts
Written guides about DriveApp.getBlob().
Automatic Weekly Backup of Google Sheets
How can we create backups of Google sheets every week or every day or every month?
Read post →What's Better Than Google Sheets?
Nothing is better than Google Sheets. You just need to learn more about the unlimited power of Google Sheets. Functions, Formulas, Apps Script and more.
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 →