Answers / Get data into your AI
How do I load an Excel workbook into a database my AI can use?
Recipe verified on
Ran on a private test instance
Short answer
Sync the folder with the workbook using cdb-localdata: each sheet becomes a table named <namespace>.<file>.<sheet>. Your AI then queries the sheets like any table, over all their rows.
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. - Install the client and sign it in.
pip install https://[you].mcpdata.org/help/download/cdb-0.3.4-py3-none-any.whl cdb-localdata login --to https://[you].mcpdata.org
- Add the folder and sync it. Here the sample orders_workbook.xlsx (sheets Orders, Customers, Products):
cdb-localdata add ./samples/excel --to https://[you].mcpdata.org --namespace xl cdb-localdata sync
- Ask your question. Give your AI this prompt:
Using mcpdata, total revenue by region from the Orders sheet (xl.orders_workbook.Orders).
What your AI does: the tool call it makes for this prompt, and what came back
query(table_name="xl.orders_workbook.Orders", group_by=["region"], agg=[{"func": "sum", "column": "revenue", "alias": "revenue"}], sort=[{"column": "revenue", "desc": true}]) → 3 rows
| region | revenue |
|---|---|
| Americas | 2,112,061 |
| EMEA | 2,053,789 |
| APAC | 1,116,644 |
The assistant needs mcpdata connected (step 1) to run the query.
Why this works
A workbook pasted into a chat loses its structure and quickly runs out of room. As tables, each sheet keeps its columns, and a changed workbook arrives as a new version on the next sync.