Creates a duplicate of a file in Drive.
class DriveApp method .makeCopy()
DriveApp is the Apps Script service.
.makeCopy() is the method name you will see after a dot in your code.
What it does
Why it's used
- Duplicate a template spreadsheet for each new project.
- Snapshot a file before a risky bulk update.
Common errors
- Forgetting parentheses on makeCopy. Write DriveApp.makeCopy(), not DriveApp.makeCopy or makeCopy by itself.
- Skipping dots between chained calls. Each step needs a dot, like DriveApp.getFileById(id).makeCopy().
- Adding spaces where they do not belong. Write DriveApp.makeCopy(), not DriveApp .makeCopy(), DriveApp.makeCopy (), or DriveApp . makeCopy().
- Wrong capitalization. Use DriveApp and makeCopy, not driveapp or makecopy.
Snippets using this method
Explore
Related methods
-
.createFile()
Creates a new file in Drive from a name and content.
-
.createFolder()
Creates a new folder in Drive.
-
.addFile()
Moves a file into a folder.
-
.removeFile()
Removes a file from a folder without deleting it.
-
.getFileById()
Loads a Drive file by its file ID.
More Apps Script
Better Sheets tutorials
Automatic Weekly Backup of Google Sheets
Related blog posts
Written guides about DriveApp.makeCopy().
Automatic Weekly Backup of Google Sheets
How can we create backups of Google sheets every week or every day or every month?
Read post →How I Send Invoice Emails Straight From a Google Sheet (With a Script You Can Copy)
A copy-ready Apps Script that emails invoices from a Google Sheet, flags bad rows, and nudges overdue clients once a week. A guest post by Tahir Abbas.
Read post →