Can Pandas read and modify a single Excel file worksheet (tab) without modifying the rest of the file?

calendar_today Asked Jan 25, 2015
thumb_up 5 upvotes
history Updated April 14, 2026

Direct Answer

I had a similar question regarding the interaction between excel and python (in particular, pandas), and I was referred to this question. Thanks to some pointers by stackoverflow…. This is an advisory response with reference links, ranked #173rd of 303 by community upvote score, from 2015.


The Problem (Q-score 10, ranked #173rd of 303 in the Excel VBA archive)

The scenario as originally posted in 2015

Many spreadsheets have formulas and formatting that Python tools for reading and writing Excel files cannot faithfully reproduce. That means that any file I want to create programmatically must be something I basically create from scratch, and then other Excel files (with the aforementioned sophistication) have to refer to that file (which creates a variety of other dependency issues).

My understanding of Excel file ‘tabs’ is that they’re actually just a collection of XML files. Well, is it possible to use pandas (or one of the underlying read/write engines such as xlsxwriter or openpyxl to modify just one of the tabs, leaving other tabs (with more wicked stuff in there) intact?

EDIT: I’ll try to further articulate the problem with an example.

  • Excel Sheet test.xlsx has four tabs (aka worksheets): Sheet1, Sheet2, Sheet3, Sheet4
  • I read Sheet3 into a DataFrame (let’s call it df) using pandas.read_excel()
  • Sheet1 and Sheet2 contain formulas, graphs, and various formatting that neither openpyxl nor xlrd can successfully parse, and Sheet4 contains other data. I don’t want to touch those tabs at all.
  • Sheet2 actually has some references to cells on Sheet3
  • I make some edits to df and now want to write it back to sheet3, leaving the other sheets untouched (and the references to it from other worksheets in the workbook intact)

Can I do that and, if so, how?

Why this Range / Worksheet targeting trips people up

The question centers on reaching a specific cell, range, or workbook object. In Excel VBA, this is the #1 source of failures after activation events: every property (.Value, .Formula, .Address) behaves differently depending on whether the parent Workbook is explicit or implicit.


The Verified Solution — niche answer (below median) (+5)

Advisory answer — community consensus with reference links

Note: the verified answer below is a reference / advisory response rather than a copy-ready snippet.

I had a similar question regarding the interaction between excel and python (in particular, pandas), and I was referred to this question.

Thanks to some pointers by stackoverflow community, I found a package called xlwings that seems to cover a lot of the functionalities HaPsantran required.

To use the OP’s example:

Working with an existing excel file, you can drop an anchor in the data block (Sheet3) you want to import to pandas by naming it in excel and do:

# opened an existing excel file

wb = Workbook(Existing_file)

# Find in the excel file a named cell and reach the boundary of the cell block (boundary defined by empty column / row) and read the cell 

df = Range(Anchor).table.value

# import pandas and manipulate the data block
df = pd.DataFrame(df) # into Pandas DataFrame <br>
df['sum'] = df.sum(axis= 1)

# write back to Sheet3
Range(Anchor).value = df.values

tested that this implementation didn’t temper existing formula in the excel file

Let me know if this solves your problem and if there’s anything I can help.

Big kudos to the developer of xlwings, they made this possible.


When to Use It — classic (2013–2016)

Ranked #173rd in its category — specialized fit

This pattern sits in the 99% tail relative to the top answer. Reach for it when your scenario closely matches the question title; otherwise browse the Excel VBA archive for a higher-consensus alternative.

What changed between 2015 and 2026

The answer is 11 years old. The Excel VBA object model has been stable across Office 2013, 2016, 2019, 2021, 365, and 2024/2026 LTSC, so the pattern still compiles. Changes that might affect you: 64-bit API declarations (use PtrSafe), blocked macros in downloaded files (Mark-of-the-Web), and the shift toward Office Scripts for web-first workflows.

help
Frequently Asked Questions

This is a below-median answer — when does it still fit?
expand_more

Answer score +5 vs the Excel VBA archive median ~4; this entry is niche. The score plus 10 supporting upvotes on the question itself (+10) means the asker and 4 subsequent voters all validated the approach.

This answer links out — what are the reference links worth following?
expand_more

Read the first external link for the canonical reference, then search this archive for a top-10 entry in the same category — advisory answers are best paired with a ranked code snippet to close the loop.

Published around 2015 — what’s changed since?
expand_more

Published 2015, which is 11 year(s) before today’s Office 2026 build. The Excel VBA object model has had no breaking changes in that window. Three things to re-test: (1) blocked macros on downloaded files (Mark-of-the-Web), (2) 64-bit API declarations (PtrSafe, LongPtr), (3) any shift toward Office Scripts for web scenarios.

Which Excel VBA pattern ranks just above this one at #172?
expand_more

The pattern one rank above is “Excel 2010 ActiveX Controls No Longer Working After Windows Updates”. If your use case overlaps, compare both before committing.

Data source: Community-verified Q&A snapshot. Q-score 10, Answer-score 5, original post 2015, ranked #173rd of 303 in the Excel VBA archive. Last regenerated April 14, 2026.