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.
1 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
1 Better Sheets tutorials
Automatic Weekly Backup of Google Sheets
Related blog posts
Written guides about DriveApp.makeCopy().