Google Drive
The Google Drive action allows you to upload files to your Google Drive.
It supports various file types and can generate files dynamically using file generators, including text files, PDFs, CSVs, and HTML files. Mechanic interacts with Google Drive via the Google Drive API, using OAuth2 for authentication.
Options
account
string
Required: the Google account email address to authenticate with
uploads
hash
Required: a has specifying files to upload and their contents
Uploads hash structure
The uploads
hash supports these properties:
overwrite
boolean
Optional: when true, files with matching names will be overwritten. Defaults to false
[path/filename]
string | hash
One or more file paths mapped to their content. Paths can include folders (e.g., 'reports/monthly/file.txt'). Content can be either a direct string or a file generator object.
Authentication
This action requires connecting a Google account with the appropriate Drive permissions. To connect an account:
Go to the Settings screen
Click Authentication
Follow the Google account connection flow
Folder Support
Files can be organized in folders by including path information in the filename:
Use forward slashes to separate folder names (e.g., "reports/2024/monthly/file.pdf")
Folders will be created automatically if they don't exist
Can only access folders created by this integration
Invalid characters not allowed:
< > : " / \ | ? *
Path Examples
Examples
Simple Text File Upload
Multiple Files with Overwrite
Files in Folders
Dynamic File Generation
Action Response
The action returns details about the uploaded files. The response is an object with the following structure:
Example response
Last updated