Sheets: export / download
TL;DR
About
A finance team keeps expenses in one shared Google Sheet, a tab per month. At the start of October someone asks their agent for September, and it calls sheets_list_tabs, picks the gid listed next to the tab named Sept 2026, exports that tab as csv and gets back a local file path that goes straight into pandas or an accounting tool's CSV import. Run it again with xlsx or pdf and you have a dated copy of the whole workbook for the audit folder. The file comes from the spreadsheet's own export address, opened in your signed-in Chrome, so whatever your Google account can open is what gets downloaded, with no Cloud project or OAuth consent screen to set up. The catch is csv and tsv, which give one tab per run. A twelve-month workbook means twelve runs, or one xlsx that you split yourself. The pdf format returns the whole document.
Input
spreadsheetId requiredSpreadsheet id or any full docs.google.com spreadsheet URL
gid optionalTab gid for csv/tsv (from sheets_list_tabs). Default 0. Ignored for whole-document formats.
Default: 0format optionalDefault xlsx. csv/tsv export a single tab (see gid).
Default: "xlsx"Output
filename requiredurl optionalSet instead of path on managed (cloud) browsers
path optionalLocal path on the agent machine
Example output
Shape only: placeholder values generated from the output schema, not a real run.
{
"url": "https://example.com/item/123",
"path": "…",
"filename": "…"
}