Process Excel and Google Sheets Using AI
Export from Sheets or Excel, process with Claude Code, and import back.
Working with Excel and Google Sheets Exports
Most of the data people deal with day-to-day lives in spreadsheets. Excel files on your computer, Google Sheets in the cloud. Claude Code can work with both. You just need to know how to get data in and out.
The quick version
Claude Code can read .xlsx files (Excel) directly. For Google Sheets, you'll export to CSV or .xlsx first. No plugins or extra setup needed.
Exporting from Google Sheets
Google Sheets lives in your browser, so Claude Code can't reach in and grab it. You need to download it first:
- Open your Google Sheet
- Go to File > Download
- Choose Comma-separated values (.csv) for a single sheet, or Microsoft Excel (.xlsx) if you have multiple tabs
- The file lands in your Downloads folder
Then move it to your working folder:
cp ~/Downloads/my_spreadsheet.csv ~/my-project/If your spreadsheet has multiple tabs and you download as CSV, Google Sheets only exports the tab you're currently viewing. Use
.xlsxif you need all tabs.
Exporting from Excel
If your data is in an Excel file on your computer, you may not need to export anything. Claude Code can read .xlsx files directly:
Read budget_2025.xlsx. Tell me:
- What sheets/tabs are in this file
- The column names on each sheet
- How many rows each sheet hasIf you want to convert to CSV first (some people prefer this for simplicity):
- Open the file in Excel
- File > Save As
- Choose CSV (Comma delimited)
- Save to your working folder
Processing spreadsheet data
Once your file is in the working folder, everything from the CSV lesson applies. Same instructions:
Read sales_data.xlsx.
Clean up the "Revenue" column:
- Remove dollar signs and commas
- Convert all values to plain numbers
- Flag any cells that contain text instead of numbers
Save as sales_data_clean.csvYou don't need to tell it "this is an Excel file." It figures that out from the extension.
Working with multi-tab spreadsheets
A single .xlsx file can have multiple tabs. Claude Code can work with all of them:
Read quarterly_report.xlsx.
This file has tabs: "Q1", "Q2", "Q3", "Q4".
Combine all four tabs into a single CSV.
Add a "quarter" column indicating which tab each row came from.
Save as full_year.csvOr pull from specific tabs:
Read budget.xlsx.
From the "Actuals" tab, get total spend by department.
From the "Forecast" tab, get projected spend by department.
Create a comparison showing actual vs. forecast for each department,
with a "difference" column (actual minus forecast).
Save as budget_vs_actual.csvGetting data back into a spreadsheet
Claude Code's output is usually a CSV, which you can open directly in Excel or import into Google Sheets:
For Excel: Just double-click the CSV file. Excel opens it automatically.
For Google Sheets:
- Open Google Sheets
- File > Import
- Choose Upload and select your CSV
- Pick "Replace spreadsheet" or "Insert new sheet"
- Click Import data
If you need the output as an actual .xlsx file instead of CSV, just ask:
Read raw_data.csv.
Clean it up: remove duplicates by email, standardize dates to MM/DD/YYYY.
Save as cleaned_data.xlsxCommon spreadsheet quirks
Excel stores dates as numbers internally. When you export, a date might show up as "45361" instead of "03/09/2025". Tell Claude to handle this:
The "date" column may contain Excel serial numbers. Convert them to YYYY-MM-DD format.A column that looks like numbers might actually be text with invisible formatting. This is common with ZIP codes, phone numbers, and IDs that have leading zeros:
Keep the "zip_code" column as text — do NOT remove leading zeros.Merged cells in Excel don't export cleanly. If your spreadsheet uses them, you'll get blank cells where the merge was:
The "category" column has blank cells where Excel had merged rows.
Fill each blank cell with the value from the nearest non-blank cell above it.One last thing: if you export while a filter is active, you only get the visible rows. Clear filters before exporting if you want the full dataset.
A real-world workflow
Say your team tracks expenses in Google Sheets and you need a monthly report:
Read march_expenses.csv (exported from Google Sheets).
1. Remove any rows where "Amount" is empty
2. Categorize expenses: if the "Description" mentions food/lunch/dinner,
set category to "Meals". If it mentions uber/lyft/taxi, set to "Transport".
Everything else is "Other".
3. Create a summary with:
- Total by category
- Top 5 individual expenses
- Number of transactions per team member
4. Save the cleaned data as march_expenses_clean.csv
5. Save the summary as march_expense_report.mdTwo outputs from one input. A cleaned dataset you could import back into Sheets, and a readable report you could paste into an email.
Recap
Working with spreadsheets in Claude Code is three steps: get the file out (export from Sheets, or just use the .xlsx for Excel), process it with the same instructions you'd write for any CSV, and open the output back in your spreadsheet app.
The only extra things to watch for are the spreadsheet-specific quirks: date formatting, merged cells, multi-tab files, and numbers stored as text. Call those out in your instructions and Claude handles the rest.
Next up
Not all data comes from spreadsheets. In the next lesson, you'll learn how to pull structured data out of PDFs — invoices, reports, contracts, and other documents that weren't designed to be machine-readable.