Use Claude Code with Excel in VS Code
You want a spreadsheet built - formulas, formatting, maybe a chart - but you don’t want to fight with Excel’s menus. Think of Claude Code as an assistant who knows Excel inside and out: you describe what you want in plain English, and it builds a real .xlsx file with working formulas. This tutorial shows you how to set up a project folder in VS Code and have Claude Code create and edit Excel spreadsheets for you.
Key Concepts
- xlsx skill - A Claude Code capability for creating and editing
.xlsxspreadsheets with real formulas, formatting, and charts. It comes automatically when you log in with your Claude account. Behind the scenes, Claude uses it to write and run small Python programs that build the file - Spreadsheet Viewer extension (formerly Excel Viewer) - VS Code extension that lets you quickly check the numbers in a spreadsheet without leaving the editor. It does not show charts
- Formulas vs. hardcoded numbers - Claude Code writes actual Excel formulas (like
=SUM(B2:B9)) so your sheet recalculates when you change the data
What You’ll Need
- Finished VS Code Basics
- Claude Code installed and working (see Install Claude Code on Windows or Install Claude Code on Mac)
- Microsoft Excel, LibreOffice Calc (free), or Google Sheets (free in your web browser) to see charts
- 20-25 minutes
Step 1: Install Python
Claude builds spreadsheets by writing small Python programs, so your computer needs Python. You won’t write any Python yourself.
- Windows:
- Go to python.org/downloads/windows
- Under the latest Python 3 release, click Windows installer (64-bit)
- Run the downloaded file
- Check the box “Add python.exe to PATH” at the bottom of the first screen, then click Install Now
- Mac:
- Go to python.org/downloads and click the yellow Download Python button
- Open the downloaded file and follow the installer, clicking Continue and Install
If VS Code is already open, close and reopen it so it can find Python.
Step 2: Install the Spreadsheet Viewer Extension in VS Code
- Open VS Code
- Click the Extensions icon in the left sidebar (or click View > Extensions)
- Search for
GrapeCity.gc-excelviewer - Click Install on Spreadsheet Viewer by MESCIUS
Note: This extension used to be called Excel Viewer by GrapeCity, and older guides and videos may still use that name. Searching for “Excel Viewer” now shows several other extensions, so search by the ID above to get the right one. The ID still starts with GrapeCity - that’s expected. The Marketplace page says it is no longer actively maintained; it still works fine for previewing the files in this tutorial.
This lets you click any .xlsx file and see its sheets, numbers, and formulas right inside VS Code. It’s great for quick checks, but it can’t show charts, colored highlighting, or dropdown lists - for those, open the file in Excel, LibreOffice Calc, or Google Sheets.
Step 3: Create Your Project Folder
- Create a new folder on your computer (e.g.,
my-excel-project) - In VS Code, click File > Open Folder and select your new folder
- Click Select Folder (Windows) or Open (Mac)
Step 4: Start Claude Code
- Click Terminal > New Terminal in VS Code
- Type this command and press Enter:
claude
- If this is your first time, a browser window opens for authentication - log in with your Claude account
- Return to VS Code once you see Claude’s welcome message in the terminal
Step 5: Create Your First Spreadsheet
- In the Claude Code terminal, type:
Create a spreadsheet called budget.xlsx with columns for Category, Monthly Amount, and Notes. Add 6 example expense categories like Rent, Groceries, and Utilities with realistic amounts. Add a Total row at the bottom that sums the Monthly Amount column using a formula.
- Press Enter
- Watch Claude write a Python script, run it, and produce
budget.xlsxin your project folder - If Claude asks permission to run commands or install helper tools (like
openpyxl, a Python add-on for spreadsheets), choose Yes to let it continue - If Claude says Python isn’t installed or can’t be found, go back to Step 1, then close and reopen VS Code
Step 6: Preview the Result
- In VS Code’s Explorer panel (left side), click
budget.xlsx - The Spreadsheet Viewer extension opens the file as a spreadsheet
- If you see scrambled text and symbols instead, VS Code opened the file as plain text - see Troubleshooting below
- Click the Total cell at the bottom - notice it’s a formula, not a typed-in number
- If you have Excel or LibreOffice Calc installed, you can also double-click the file in File Explorer (Windows) or Finder (Mac) to open it there instead
Step 7: Ask Claude to Add a Chart
- Back in the Claude Code terminal, type:
Add a pie chart to budget.xlsx showing each category's share of the total monthly spending.
- Press Enter
- To see the chart, open
budget.xlsxin Excel or LibreOffice Calc (double-click it in File Explorer or Finder), or upload it to Google Sheets - The Spreadsheet Viewer in VS Code won’t show the chart - that’s expected, the chart is still in the file
Step 8: Edit the Data and Ask Claude to Update It
- In Excel or LibreOffice Calc, change one of the amounts (for example, double the Rent value)
- Save the file and close it
- Don’t make this edit in the Spreadsheet Viewer - saving from there can remove the chart from the file
- In the Claude Code terminal, type:
I changed some numbers in budget.xlsx. Recalculate the totals and make sure the chart still matches the data.
- Press Enter
- Claude reads your edits, checks the formulas, and confirms everything lines up
No Excel or LibreOffice? Skip the manual edit and ask Claude instead: “Double the Rent amount in budget.xlsx.”
This is the core workflow: describe what you want, let Claude build it, check the result, and ask for changes in plain English.
Step 9: Ask Claude to Clean Up Messy Data
Claude Code is also useful for fixing spreadsheets that are already a mess.
- Type:
Create a messy_sales.csv file with 15 rows of sales data that has some issues: a few blank cells, inconsistent date formats, and one duplicate row. Then create a cleaned version called sales_clean.xlsx that fixes these problems and explain what you fixed.
- Press Enter
- Review the summary Claude gives you of what it found and fixed
- Open
sales_clean.xlsxto confirm the data looks right
Next Steps
- Ask Claude to build a spreadsheet from a CSV file you already have (drag it into your project folder first)
- Try more advanced requests: “add conditional formatting so any category over $500 turns red”
- Ask Claude to add a second sheet that summarizes data from the first sheet
- Combine this with Use GitHub Desktop with Claude Code to save versions of your spreadsheets as you go
- Move on to Vibe Coding a Budget Tracker in Excel to build a full multi-sheet project
Troubleshooting
budget.xlsxopens as scrambled text and symbols (starting withPK): VS Code is showing the raw file because no spreadsheet viewer handled it. The file itself is fine - an.xlsxis a compressed bundle, not plain text. Check that Spreadsheet Viewer by MESCIUS (GrapeCity.gc-excelviewer) is installed and enabled, then close the tab, right-clickbudget.xlsxin the Explorer panel, choose Open With…, and pick Excel Editor (Spreadsheet Viewer’s editor for.xlsxfiles). If another spreadsheet extension is also installed, choose Configure default editor for ‘*.xlsx’… in the same list and pick Excel Editor so single-clicking the file uses it from now on.- Spreadsheet Viewer shows a blank or broken preview: Close the tab and reopen the file. If it still fails, open the file in Excel, LibreOffice Calc, or Google Sheets instead - the file itself is fine, it’s just a preview glitch.
- Formula cells show blank instead of a number: This usually means the file wasn’t recalculated after being written. Ask Claude: “Recalculate budget.xlsx and confirm there are no formula errors.”
- Claude’s changes don’t show up: Make sure you’re looking at the same file Claude edited (check the filename it mentions). Close and reopen the tab in VS Code to force a refresh.
- “claude is not recognized” in the terminal: Claude Code isn’t installed correctly. Revisit the installation guide for Windows or Mac.
- Chart is missing: The Spreadsheet Viewer can’t display charts. Open the file in Excel, LibreOffice Calc, or Google Sheets. If the chart is missing there too, ask Claude: “The pie chart is missing from budget.xlsx - please add it back.”
Workflow Summary
- VS Code - Your project folder and a place to preview spreadsheets with the Spreadsheet Viewer extension
- Claude Code - Writes and edits real
.xlsxfiles with working formulas, based on your plain-English requests - Excel / LibreOffice / Google Sheets - For viewing charts and manually tweaking the files Claude creates
- Iterate - Describe what you want, check the result, describe the next change
Created by Steven Ge on September 21, 2026.