Google Drive is one of the most common destinations in business automation â receipts, reports, exports, backups. The n8n Google Drive node gives you full file management without writing a single line of custom API code.
This guide covers every operation the node supports, the gotchas that trip people up, and a free workflow JSON at the end.
Prerequisites
- n8n (self-hosted or cloud)
- A Google account
- A Google Cloud project with the Google Drive API enabled
- OAuth 2.0 credentials configured in n8n (Google Drive credential type)
Tip: To enable the API, go to Google Cloud Console â APIs & Services â Library â search "Google Drive API" â Enable.
Setting Up the Credential
- In Google Cloud Console, create an OAuth 2.0 Client ID (Web application type).
- Add your n8n callback URL as an Authorized Redirect URI:
- Cloud:
https://your-instance.n8n.cloud/rest/oauth2-credential/callback - Self-hosted:
https://your-domain.com/rest/oauth2-credential/callback
- Cloud:
- In n8n â Credentials â New â Google Drive OAuth2 API â paste Client ID + Secret â Connect.
The one credential covers Google Drive, Docs, and Sheets â you only need to set it up once.
Operations Overview
| Operation | What it does |
|---|---|
| Upload | Upload a binary file to a folder |
| Download | Download a file as binary data |
| Create | Create a new empty file or Google Doc/Sheet |
| Delete | Move a file to trash |
| Copy | Duplicate a file |
| Move | Move file to a different folder |
| Share | Set sharing permissions |
| Get | Get file metadata by ID |
| Search | List files matching a query |
| Update | Update file metadata or content |
1. Upload a File
The Upload operation takes a binary field from a previous node and writes it to Drive.
Key settings:
- File Name â the name the file will have in Drive
- Parents â the folder ID to upload into (leave empty for My Drive root)
-
Binary Data field â which binary property contains the file (
databy default)
Example: save a PDF report to a specific folder
- HTTP Request node â fetches a PDF â outputs binary field
data - Google Drive node â Operation: Upload â File Name:
report-{{$now.format('yyyy-MM-dd')}}.pdfâ Parents:<your-folder-id>
Finding a folder ID: Open the folder in Google Drive. The ID is the last segment of the URL: https://drive.google.com/drive/folders/THIS_IS_THE_ID
2. Download a File
The Download operation fetches a file by its ID and outputs binary data you can pipe to another node (send as email attachment, write to disk, convert, etc.).
Key settings:
- File ID â the Drive file ID (from a Search or Get operation upstream)
-
Binary Data field â the property name to write the binary to (default:
data)
Gotcha with Google Docs/Sheets/Slides: These are Google Workspace native formats, not real files. You must set Google File Conversion and choose an export MIME type:
- Google Docs â
application/pdfortext/plain - Google Sheets â
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet(xlsx) - Google Slides â
application/pdf
3. Search / List Files
Search is the most powerful operation. It uses Google Drive's query syntax to find files.
Common query examples:
# Files in a specific folder
'<folder-id>' in parents
# Files modified in the last 7 days
modifiedTime > '{{$now.minus({days:7}).toISO()}}'
# PDFs only
mimeType = 'application/pdf'
# Files containing "invoice" in the name
name contains 'invoice'
# Combine conditions
'<folder-id>' in parents and name contains 'report' and trashed = false
Set these in the Query field. The node returns up to 1,000 results; use the Limit field and pagination token for larger sets.
Fields returned: id, name, mimeType, size, modifiedTime, webViewLink, parents.
4. Create a File or Folder
Create lets you make a new empty file or a Google Workspace document:
-
Folder: MIME type
application/vnd.google-apps.folder -
Google Doc:
application/vnd.google-apps.document -
Google Sheet:
application/vnd.google-apps.spreadsheet
Example: create a new Sheet for each new Stripe payment, named with the order ID.
5. Share a File
The Share operation sets permissions without leaving n8n:
-
Role:
reader,writer,commenter,owner -
Type:
user(specific email),anyone(public link),domain
To create a public shareable link: Type = anyone, Role = reader.
Common Gotcha: Binary vs. Text
The Google Drive node works with binary data, not raw text strings. If you want to upload a text or JSON file:
- Add a Code node before the Drive node:
const content = JSON.stringify($input.all()[0].json, null, 2);
const buf = Buffer.from(content, 'utf-8');
return [{ binary: { data: { data: buf.toString('base64'), mimeType: 'application/json', fileName: 'output.json' } }, json: {} }];
- Then the Drive Upload node reads the
databinary field.
Free Workflow: Auto-backup n8n Exports to Google Drive
This workflow runs daily, exports a list of your workflows as JSON, and uploads the file to a Drive backup folder.
{
"name": "Daily n8n Backup to Google Drive",
"nodes": [
{
"parameters": { "rule": { "interval": [{ "field": "cronExpression", "expression": "0 3 * * *" }] } },
"name": "Schedule (3am daily)",
"type": "n8n-nodes-base.scheduleTrigger",
"position": [200, 300]
},
{
"parameters": {
"method": "GET",
"url": "={{ $env.N8N_HOST }}/rest/workflows",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth"
},
"name": "Get All Workflows",
"type": "n8n-nodes-base.httpRequest",
"position": [420, 300]
},
{
"parameters": {
"jsCode": "const content = JSON.stringify($input.all()[0].json, null, 2);\nconst buf = Buffer.from(content, 'utf-8');\nconst today = new Date().toISOString().slice(0,10);\nreturn [{ json: { filename: `n8n-backup-${today}.json` }, binary: { data: { data: buf.toString('base64'), mimeType: 'application/json', fileName: `n8n-backup-${today}.json` } } }];"
},
"name": "Prepare Binary",
"type": "n8n-nodes-base.code",
"position": [640, 300]
},
{
"parameters": {
"operation": "upload",
"name": "={{ $json.filename }}",
"parents": ["YOUR_BACKUP_FOLDER_ID"],
"inputDataFieldName": "data"
},
"name": "Upload to Drive",
"type": "n8n-nodes-base.googleDrive",
"position": [860, 300]
}
],
"connections": {
"Schedule (3am daily)": { "main": [[{ "node": "Get All Workflows" }]] },
"Get All Workflows": { "main": [[{ "node": "Prepare Binary" }]] },
"Prepare Binary": { "main": [[{ "node": "Upload to Drive" }]] }
}
}
Replace YOUR_BACKUP_FOLDER_ID with your Drive folder ID.
Key Takeaways
- Credential setup is the hardest part â get the redirect URI exactly right and enable the Drive API in GCP.
- Use Search before Download â get the file ID first, then fetch the binary.
- Google Workspace files need export MIME types â native Docs/Sheets can't be downloaded as-is.
- Folder ID = last URL segment â copy it directly from your browser.
I sell a n8n Workflow Starter Pack ($29) with 10 production-ready workflows including full error handling, credential patterns, and step-by-step setup guides. Drop a comment if you have questions about the Drive node â happy to help.
Top comments (1)
What Drive operation do you use most in your workflows? Upload for backups, Download for processing files, or Search to build dynamic file pipelines? Drop your use case below - happy to help troubleshoot credential or query issues.