Can Git Track Excel Files? Version Control Explained

How-to basics · Updated November 19, 2026

Yes. Git can track Excel workbooks such as .xlsx, .xlsm, .xlsb, and .xls files, preserving committed versions and showing when a file changed. The main limitation is that Git usually cannot display useful cell-by-cell differences or automatically merge edits to a workbook, so it is best suited to deliberate, manageable changes rather than simultaneous spreadsheet collaboration.

What it means for Git to track a workbook

Git is a version control system: it records file contents in commits, lets you compare a working copy with earlier committed states, and can restore a previous version. It does not need to understand Excel formulas, worksheets, charts, or formatting to store a workbook. To Git, a workbook is a file whose contents have changed.

For example, a project repository might contain a workbook called forecast.xlsx. After you add and commit it, Git can record later revisions, identify which commit introduced a change, and retrieve the workbook as it existed in an earlier commit. The workbook remains an Excel file when checked out; Git does not convert it into a spreadsheet-specific format.

There is an important distinction between tracking a file and interpreting it. Git can tell that the workbook changed, but for most Excel formats it cannot explain that cell D14 changed from 120 to 135, identify a formula edit in a readable way, or combine two people’s edits to separate cells. Those are spreadsheet-level operations, not ordinary Git capabilities.

Why Excel changes are hard to compare

Many common Excel formats are not plain text. An .xlsx file is a ZIP package containing multiple parts, including XML files for worksheets and workbook information. An .xlsm workbook uses a similar package structure and can include a VBA project. The older .xls format and the .xlsb format use binary representations rather than being simple text tables.

Although some material inside an .xlsx package is XML, Git does not normally unpack the workbook and present those parts as a clear spreadsheet diff. It sees the saved file as binary data for comparison purposes. A workbook can also change internally for reasons that are not obvious from the visible cells: Excel may update metadata, calculation information, styles, relationships, or other package contents when saving. The resulting file-level change can therefore be much larger or noisier than the user’s actual edit.

Git stores file snapshots and uses compression and delta techniques to reduce storage where possible. However, Excel packages are already compressed, and a small edit can alter the ZIP package in ways that make changes difficult to represent compactly. Repeatedly committing large workbooks can make a repository grow faster than expected.

CSV files are a useful contrast. A CSV is plain text, so Git can often show line-based differences. But CSV stores only a table of text values: it does not preserve workbook formatting, multiple sheets, charts, macros, or many other Excel features. It is a reasonable choice for a data export, not a complete replacement for a complex workbook.

A basic workflow for versioning Excel files

For a small team or a workbook that changes occasionally, ordinary Git tracking may be enough. From the repository folder, you can add and commit the file using the usual Git commands:

  1. git add forecast.xlsx stages the workbook for the next commit.
  2. git commit -m "Add quarterly forecast" records the staged version in the repository history.
  3. After editing and saving the workbook, run git status to see that it changed, then stage and commit the new version.

A commit records the version of the file at that point; it does not automatically save every keystroke or every time Excel saves. If you want to inspect an earlier version, use Git’s history or check out the relevant commit in a separate working copy. Be cautious about restoring an old workbook over a newer one: doing so replaces the current file in your working directory.

It is useful to write commit messages that describe the spreadsheet change rather than merely saying “update.” For example, “Revise product assumptions on Inputs sheet” gives a future reader more context, even though Git itself cannot verify which cells were changed. If cell-level review matters, record important changes in a change log or commit description.

When Git LFS is useful

Git Large File Storage (Git LFS) is an extension for handling large files. Instead of placing each large workbook’s full contents directly in the ordinary Git object database, Git stores a small pointer file there and keeps the actual file contents in LFS storage. When someone checks out a revision, Git LFS retrieves the corresponding workbook, assuming the person has access and the hosting service supports the repository’s LFS setup.

You might consider LFS if workbooks are large, numerous, or causing repository clones and history to become unwieldy. A typical setup for .xlsx files is to install Git LFS, initialize it for the repository, and configure the file pattern before adding the workbooks:

git lfs install
git lfs track "*.xlsx"

The tracking command writes a rule to a .gitattributes file. Commit that file along with the workbook so other contributors use the same rule. If your project also uses .xlsm, .xlsb, or .xls files, add suitable patterns for those extensions too; tracking .xlsx does not automatically cover every Excel format.

LFS changes storage handling, not spreadsheet understanding. It does not create readable cell-level diffs or merge conflicting workbook edits. Hosting providers may also impose LFS storage or transfer quotas, fees, or configuration requirements, so check the terms for the service your team uses. Adding LFS rules after large files are already in history does not by itself remove those files from earlier commits; rewriting history to migrate old content is a separate operation that needs coordination.

Branches, conflicts, and team editing

Git branches let contributors work on separate lines of project history, but they do not make an Excel workbook mergeable. Suppose one person changes prices in a workbook while another changes formulas, and both save different versions of the same file. When Git combines their branches, it may report a conflict because the same binary file differs on both sides. It cannot safely decide which workbook contents to keep or merge the two sets of cell edits.

The usual resolution is for a person to choose one version, or open the competing copies in Excel and manually transfer the needed changes into a single workbook. The resolved file is then staged and committed. Keep the original copies until the resolution is checked; a mistaken choice can discard someone’s work. Agreeing in advance who edits a workbook, or assigning changes to separate workbooks, can reduce conflicts.

Some Git hosting services and Git LFS workflows support file locking, which can help signal that one person is editing a file. Locking depends on the hosting service, client setup, and repository configuration; it is not a universal feature of basic Git, nor does it merge changes. Teams should verify that the lock workflow is available and consistently used before relying on it.

How to make workbook changes reviewable

Even when Git cannot show cell-level differences, a few habits can make spreadsheet history more useful:

  • Keep a workbook focused. Separate unrelated datasets or processes rather than putting every project’s information into one enormous file.
  • Use clear sheet names, structured tables, and consistent layouts so people can locate changes when opening a version.
  • Describe the purpose and affected sheets in commit messages, and keep a change log inside the workbook when readers need more detail.
  • For important calculations, consider maintaining formula documentation or tests in text-based files alongside the workbook.
  • Before committing, reopen the saved workbook and check that it contains the intended data, formulas, and macros.

Specialized tools can extract workbook content or generate spreadsheet-aware comparisons, but their capabilities and reliability vary. They may need to be configured separately and may not cover every Excel feature. Treat such output as an aid to review, not proof that two workbooks are equivalent. In particular, hidden sheets, names, external links, charts, macros, and formatting may matter even when a comparison report emphasizes cells.

Choosing Git or another version history option

Git is a good fit when the workbook is part of a software or data project, changes are committed intentionally, users understand branches and commits, and preserving project history alongside code is valuable. It is also useful when a team wants to keep workbook versions in the same repository as scripts that create or analyze the data.

For frequent simultaneous editing, Microsoft 365 collaboration features may be more suitable. Excel supports co-authoring for compatible workbooks stored in supported cloud locations such as OneDrive or SharePoint, subject to Microsoft’s requirements and the workbook’s features. These services provide version history and collaboration workflows designed around shared documents. They are not a substitute for Git’s branching and project-wide history, but can be more convenient when people need to edit the same workbook together.

Other document management systems may also offer version history, permissions, and file locking. The choice depends on whether the main need is collaboration, audit history, reproducible project changes, or code integration. A team can use both approaches for different purposes, but it should define which location is authoritative to avoid divergent copies.

Security and backup considerations

A Git repository can preserve sensitive spreadsheet content in its history, even after a later commit removes that content from the current version. Do not assume that deleting a worksheet, password-protecting a workbook, or deleting a file from the latest commit erases all earlier copies in the repository. Anyone with access to the history may be able to retrieve earlier versions. Avoid committing passwords, personal data, confidential exports, or credentials; follow your organization’s storage and retention rules.

Git is also not automatically a complete backup plan. A local repository can be lost with its computer, and a hosted repository may have different retention, access, and recovery properties from a dedicated backup. Keep appropriate backups, restrict repository access, and understand how your host handles deletion and recovery. If sensitive information is committed accidentally, removing it may require history rewriting and coordinated cleanup, and previously cloned copies may remain outside your control.

Frequently Asked Questions

Can Git show changes between two Excel files?

For typical .xlsx and other binary workbooks, Git can show that the file changed and identify the commits involved, but its standard diff usually cannot display a useful comparison of cells, formulas, or formatting. A separate spreadsheet-aware comparison tool may help.

Can Git merge two Excel workbooks?

Not reliably at the worksheet-cell level. If two branches change the same workbook, Git generally needs a person to choose or manually reconcile the versions. Git LFS does not add workbook merging.

Should I use Git LFS for .xlsx files?

Use it when workbook size or repository growth is a real concern and your hosting service supports LFS within acceptable limits. For a few small workbooks, ordinary Git may be simpler. LFS affects storage, not diffs or merges.

Can I put an Excel workbook in GitHub?

Yes, if the repository and hosting service permit the file under their current size, storage, and usage rules. Large workbooks may require Git LFS. Check the service’s current documentation rather than assuming every repository has the same limits.

Is Git a good way to collaborate on Excel?

It can work for occasional, coordinated edits where history and project integration matter. For people editing one workbook at the same time, co-authoring in a supported Microsoft 365 cloud location is often more practical because Git does not combine their cell edits.

Related

Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.

More in How-to basics

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.