Copy File
Copies a file in Google Drive to a new location or with a new name.
Common Properties
- Name - The custom name of the node.
- Color - The custom color of the node.
- Delay Before (sec) - Waits in seconds before executing the node.
- Delay After (sec) - Waits in seconds after executing node.
- Continue On Error - Automation will continue regardless of any error. The default value is false.
info
If the ContinueOnError property is true, no error is caught when the project is executed, even if a Catch node is used.
Inputs
- Drive Id - The identifier for the connected Google Drive service obtained from the Connect node.
- File Id - The unique identifier of the file to be copied.
Options
- File Name - (Optional) The new name for the copied file. If not specified, the original file name will be used.
- Mime Type - The MIME type for the copied file. Supported types include:
- Default (application/octet-stream)
- GDocs (application/vnd.google-apps.document)
- GSheets (application/vnd.google-apps.spreadsheet)
- pdf (application/pdf)
- csv (text/plain)
- jpeg (image/jpeg)
- png (image/png)
- txt (text/plain)
- doc (application/msword)
- xls (application/vnd.ms-excel)
- xlsx (application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
- html (text/html)
- Parent Folder Id - (Optional) The ID of the folder where the copied file should be placed.
Output
- file_id - The unique identifier of the newly created copied file.
How It Works
The Copy File node creates a copy of an existing file in Google Drive. When executed, the node:
- Validates the required inputs (Drive Id and File Id)
- Retrieves the Google Drive service client using the provided Drive Id
- Creates a new File object with the specified name and MIME type
- Uses the Google Drive API to copy the file with the Files.Copy method
- If a Parent Folder Id is specified, moves the copied file to that folder
- Returns the ID of the newly created file
Requirements
- A valid Google Drive connection established using the Connect node
- The File Id of an existing file in Google Drive
- Appropriate permissions to read the source file and create files in the destination
Error Handling
The node will return specific errors in the following cases:
- Empty or invalid Drive Id
- Empty or invalid File Id
- Invalid MIME type selection
- Google Drive API errors during the copy operation
- Insufficient permissions to read the source file or create the copy
- Invalid Parent Folder Id (if specified)
Usage Notes
- The copied file will have the same content as the original but will be a separate file with its own ID
- If no File Name is specified, the copied file will have the same name as the original
- The MIME type determines how Google Drive handles the file (e.g., converting to Google Docs format)
- If a Parent Folder Id is specified, the copied file will be placed in that folder
- The original file remains unchanged after the copy operation