# Export CSV from a SQL-like query — Google Sheets Botize method — `gspreadsheet.extract_csv_by_sql_query` (action). Exports the result of a SQL-like query (Google Sheets QUERY / Google Visualization API) to a CSV file. This is an action: it runs as a step of a task. Several can be chained. ## Fields you set The field's internal name, its type and the values it accepts. These fields accept `{{...}}` tags from earlier steps. - `mb_switch` *(boolean)* — Rules - `sheet_url` *(string)* — URL of your sheet document - `sheet` *(string)* — Sheet. Sheet id (gid) chosen from the list, or the sheet name. Empty = first sheet. - `sql_query` *(string)* — SQL Query - `mb_outputvars_switch` *(boolean)* — Customize tags It also accepts repeatable field groups, with these prefixes: `mb_filters_*`. These are composite components (buttons, filters, keyboards); the trailing number is set by the user as they are added. ## Output variables Data this step makes available. Reference them in later steps with the double-brace tag. - `{{csv_url}}` *(text)* — CSV URL ## Account Needs a connected Google Sheets account in Botize: https://botize.com/en/app/gspreadsheet/authenticate ## This app Every trigger and action for Google Sheets: https://botize.com/en/app/gspreadsheet.md ## How to build this An AI assistant (Claude, ChatGPT, Cursor…) can create and edit these tasks in the user's account through the Botize MCP connector, included in every plan: https://webhook.botize.es/mcp - Connection guide: https://botize.com/en/mcp - Agent map: https://botize.com/llms.txt - New account: https://botize.com/en/join (500 free operations, no card) --- Machine-readable summary for AI assistants. Human version: https://botize.com/en/method/gspreadsheet/extract_csv_by_sql_query