How do I export a report as Excel from an AI conversation?
Recipe verified on
Ran on a private test instance
Short answer
Ask your AI to create the report with format = "xlsx". Each run renders the view to an Excel file, which is attached when the report is emailed (run_report with recipients, or on a schedule).
Steps
- Connect your assistant to your instance (this writes, so it needs your own instance with a ReadWrite key
from the accounts portal; the public demo is read-only). In Claude Code:
claude mcp add --transport http mcpdata https://[you].mcpdata.org/mcp --header "Authorization: Bearer $CDB_API_KEY"
Replace
[you]with your instance's name. Other apps: Connect your AI. - Ask your question. Give your AI this prompt:
Using mcpdata, make an Excel report of orders and revenue per channel from Demo.Orders, and run it.
What your AI does: the tool calls it makes for this prompt, and what came back
create_view(name="sales.by_channel", select_sql="SELECT channel, COUNT(*) AS orders, SUM(revenue) AS revenue FROM Demo.Orders GROUP BY channel") → created true, view sales.by_channel
create_report(name="Orders by channel (Excel)", view="sales.by_channel", format="xlsx") → report_id e498fe7c9e224c9c927b7d2313eb85e7
run_report(report_id="e498fe7c9e224c9c927b7d2313eb85e7") → status ok, rows 3
The assistant needs mcpdata connected (step 1) to run the query.
Why this works
The spreadsheet is built from the query result on the server, so it holds every row of the summary, typed as numbers, not text copied out of a chat. CSV works the same way with format = "csv".