Google Drive and Google Sheets
Mechanic provides a streamlined integration with Google Drive and Google Sheets, allowing you to automate common file management and spreadsheet operations without having to directly interface with the Google Drive API.
Authentication
Before using Google integrations connect your Google accounts:
Go to Settings → Authentication in Mechanic
Select Google in the provider list
Connect your Google account
Grant the necessary permissions when prompted
Google Drive Integration
The Google Drive action allows you to upload and manage files in Google Drive. See in-depth documentation of the Google Drive action here.
Basic Usage
{% action "google_drive" %}
{
"account": "your.email@example.com",
"uploads": {
"overwrite": true,
"simple.txt": "Hello, world!",
"report.pdf": {
"pdf": {
"html": "<h1>Report</h1><p>Content here</p>"
}
}
}
}
{% endaction %}Supported Features
Upload multiple files in a single action
Paths can include folders (e.g., 'reports/monthly/file.txt')
Overwrite existing files (optional)
Generate various file types (TXT, PDF, CSV, HTML, etc.) using Mechanic File generators or linking from external URLs (e.g. Shopify Files - CDN)
Google Sheets Integration
The Google Sheets action enables focused interaction with spreadsheets, including creating spreadsheets with one or many sheets, reading and writing data, deleting rows, managing sheets (tabs), and exporting. \
See in-depth documentation of the Google Sheets action here.
Basic Usage
Supported Operations
create_spreadsheet: Create new spreadsheets, with one or many named sheetsappend_rows: Add data to existing spreadsheetsupdate_rows: Overwrite data at a specific rangeclear_values: Clear values from a range or a whole sheetget_values: Read values from a spreadsheet into the action resultdelete_rows: Delete a span of rows from a sheetadd_sheet: Add a sheet (tab) to an existing spreadsheetrename_sheet: Rename a sheet (tab)delete_sheet: Delete a sheet (tab)export_spreadsheet: Export spreadsheets in various formats
File Type Support
Drive Upload Formats
Text files
PDFs (generated from HTML)
CSV files
HTML files
Any binary file format (e.g. ZIP)
Sheets Export Formats
XLSX (Excel)
CSV
PDF
HTML
ODS
TSV
Permissions
The integration requires the https://www.googleapis.com/auth/drive.file scope, which allows:
Access to files created by the app
Access to files explicitly shared with the app
No access to other files in your Google Drive
Last updated
Was this helpful?