Export Query

Export a saved query's results as a CSV or Excel file.

Tool: draxlr_export_query

Exports a saved query's results as a CSV or Excel (.xlsx) file. Works for both query types — raw SQL queries and query-builder queries (the tool detects which and exports accordingly). The tool returns a short-lived downloadUrl (valid for 5 minutes) that you open in your browser to download the file. Get a queryId from List Saved Queries or Get Query.

Parameters

ParameterTypeRequiredDescription
queryIdstringYesThe saved query id to export (from List Saved Queries or Get Query)
formatstringNoExport format: csv (default) or xlsx

Example

"Export my 'Monthly revenue' query as an Excel file."

Arguments:

{
  "queryId": "6690ab42bc2e4a0012cd8123",
  "format": "xlsx"
}

Response

{
  "message": "Your export is ready. Open this link to download query-6690ab42bc2e4a0012cd8123.xlsx (the link expires in 5 minutes):",
  "downloadUrl": "https://api.draxlr.com/mcp/download/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "fileName": "query-6690ab42bc2e4a0012cd8123.xlsx",
  "queryId": "6690ab42bc2e4a0012cd8123",
  "format": "xlsx"
}
FieldDescription
messageA human-readable summary, including how long the link is valid
downloadUrlA short-lived link (valid for 5 minutes) to download the file
fileNameThe name the downloaded file will be saved as
queryIdThe saved query that was exported
formatThe format the file was exported in

Read-only only:

Only read (SELECT) queries can be exported. Non-read statements are rejected.