Google app
Google Drive
DriveApp lets a script open files by ID, find a named folder with getFoldersByName, and save copies or PDFs to a folder you choose.
Choose a task using Google DriveStart with an outcome
Tasks that use Google Drive
Choose the result first. Each card opens a step-by-step guide.
- Google Drive Save labeled Gmail attachments to Drive
Copy the attachments from chosen Gmail conversations into one Drive folder. You pick the conversations by adding a label to them, and the script saves every attachment it finds there.
- Google Drive Back up a spreadsheet to Drive every week
Keep a dated copy of a spreadsheet in a Drive folder. Run the setup function once, and every Monday morning the script saves a new copy with the date in its name.
- Google Drive Email a Google Doc as a PDF
Send a Google Doc to someone as a PDF attachment. Paste the file ID of the Doc into the script, and it builds the PDF and emails it. The Doc itself is not changed.
- Google Drive Fill a Google Doc template from a Sheet row
Make one filled-in copy of a template Doc for each row on a Letters tab. The script swaps {{Name}}, {{Date}}, and {{Amount}} for the values in the row and writes the link to the copy in column D.
Snippets
Snippets for Google Drive
Complete functions you can paste and run one at a time.
Object reference
Objects available in Google Drive
Open an object when you need to get it, try a common action, or inspect exact method signatures.
- Object reference Drive folder
A DriveApp.Folder is a container in Google Drive. Find one by name with DriveApp.getFoldersByName(name) or by ID with DriveApp.getFolderById(id).
- Object reference DriveApp.getFileById and Drive files
DriveApp.getFileById(id) returns a DriveApp.File for a Google Drive file, such as a Doc, Sheet, or PDF. Pass the file ID as a string. The call throws an exception if the file does not exist or the executing account cannot access it.