A practical field guide from Automation Ace.
How to Get a CSV Version of a Google Sheets or Excel File via Google Drive
When you need a CSV file — for an import, a webhook payload, an email attachment, or an automated pipeline — and your data lives in Google Sheets or as an Excel file in Google Drive, there is a clean way to get it without manually downloading anything. Google Drive exposes export URLs that let you convert files to CSV programmatically, and those URLs work perfectly inside Zapier, Make, HTTP steps, and custom scripts.
This technique is especially useful in automation workflows where you need to pass tabular data downstream — sending a CSV to a webhook endpoint, attaching a snapshot to an email, or uploading a converted file to another service on a schedule.
Exporting a CSV from a Native Google Sheets File
For a file that is a native Google Sheets document (not an uploaded Excel file), the export URL pattern is:
https://docs.google.com/spreadsheets/d/FILE_ID/export?format=csv&gid=SHEET_GID
- FILE_ID — the long alphanumeric string in the Google Sheets URL between
/d/and/edit. - gid — the sheet tab ID, visible in the URL as
#gid=0when you are on that tab. The first sheet is usually0. Omit thegidparameter to export the first (default) sheet. - The request must be authenticated. In Zapier, use the Google Drive or Google Sheets app to make the request, or use a Webhooks by Zapier step with a Google OAuth bearer token.
The response is a plain-text CSV that you can pipe directly into subsequent steps — no intermediate file download required. In Zapier you can capture this response in a Webhooks by Zapier GET step and pass the body as a data field to another action.
Exporting a CSV from an Uploaded Excel File (.xlsx or .xls)
When a file was uploaded to Google Drive as an Excel file (it was not converted to Google Sheets format on upload), the export URL is different because the file lives in Drive as a binary object, not as a native Sheets document. You need to use the Drive Files API export endpoint:
https://www.googleapis.com/drive/v3/files/FILE_ID/export?mimeType=text/csv
However, this only works for Google Workspace native formats (Docs, Sheets, Slides). An uploaded .xlsx or .xls file is a binary MIME type, so the Drive export API will not convert it. The correct approach for Excel files is to first convert the file to Google Sheets format, then export the resulting Sheets file as CSV.
You can automate this conversion in Zapier using the Google Drive "Copy File" action with the option to convert to Google format enabled, then use the export URL on the resulting Sheets file ID. Alternatively, use the Google Drive API files.copy endpoint with "mimeType": "application/vnd.google-apps.spreadsheet" in the request body.
Using This in a Zapier Workflow
Once you have the CSV, Files by Zapier can extract its rows for processing in the same Zap.
A common pattern for getting a CSV from Google Sheets inside a Zap:
- Trigger: Schedule by Zapier (daily, weekly, or on a specific day) or any event that should kick off the export.
- Action — Webhooks by Zapier (GET): Set the URL to the Google Sheets export URL above, with authentication configured. The response body will be the raw CSV text.
- Action — next step: Pass the CSV body to an email attachment, a Slack file upload, an Airtable import, or another service that accepts CSV data.
For more complex multi-step Zapier workflow designs, you can combine this pattern with a Paths step — for example, exporting different sheets based on a day of the week or a trigger value.
Getting a Specific Sheet Tab as CSV
When your Google Sheets file has multiple tabs and you need a specific one, the gid parameter is what distinguishes them. To find the GID for any tab:
- Open the Google Sheets file in your browser.
- Click the tab you want.
- Look at the URL — the GID appears at the end as
#gid=1234567890. - Use that number in the export URL's
gidparameter.
If you need to export all tabs as separate CSVs, you will need to make one GET request per tab, each with a different GID. This is straightforward to automate with a loop in Make or with a Zapier table of GID values.
The export URL approach is one of the most underused techniques in Google Drive automation. It lets you treat a Google Sheet like a live data endpoint — pulling fresh CSV snapshots on demand without any manual steps or Drive add-ons.
Authentication Considerations
Export URLs require that the caller has at least read access to the file. Options for handling authentication in automation contexts:
- Zapier's Google apps: When you use the Google Sheets or Google Drive app in Zapier, the OAuth token is managed automatically. Use the "Make API Call" action in Google Drive to hit the export endpoint with the connected account's credentials.
- Service account: For server-side automation outside Zapier, a Google Cloud service account with Drive access can authenticate requests without user interaction — useful for scheduled scripts or Python or JavaScript automation scripts.
- Public files: If the Google Sheets file is published to the web (File → Share → Publish to web), the export URL works without authentication. This is useful for read-only public datasets but not appropriate for private business data.
For more detail on authenticating API requests in automation workflows, see the guide to API authentication for automation. If you are working with Google Drive files as part of a broader automation stack, the related post on Google Sheets automation cleanup covers best practices for keeping spreadsheet-based workflows reliable long-term.
Disclaimer: This article may include links to apps, products, or services. Some links may be affiliate links, which means Automation Ace may earn a commission at no extra cost to you.