介绍一款小巧的Excel比对工具-DiffExcel

【缘起:此前找了一通,没有找到免费又好用的Excel比对工具,而ExcelBDD需要把Excel文件存放到Git,因此迫切需要Excel比对工具。

最新升级到V1.3.3,因为git diff有变化,原来是git diff会修改文件名,现在不改了,导致老版DiffExcel失效】

DiffExcel is an open-source and text-based tool to compare Excel, it supports Git diff.

It looks like the below:

Pre-Requirement

  • Microsoft Excel
  • PowerShell, which is pre-installed in Windows10 and the later

Install

  1. Open PowerShell
  2. execute Install-Script -Name DiffExcel
    2.1 if updating, execute Update-Script -Name DiffExcel

Direct Usage

In PowerShell, use below syntax:

DiffExcel OldExcelFilePath NewExcelFilePath

e.g. DiffExcel E:\Code\ExcelBDD\DiffExcel\Test\OldFile.xlsx E:\Code\ExcelBDD\DiffExcel\Test\NewFile.xlsx

DiffExcel OldExcelFilePath NewExcelFilePath -Open

-Open: if Open switch is set, the new Excel file will open if any change is found.

Config Git Diff

Prepare a Diff bat file

复制代码
PowerShell -ExecutionPolicy Unrestricted -Command DiffExcel %2 %5

save this bat file to somewhere on your computer, e.g. E:/Code/ExcelBDD/DiffExcel/DiffExcel.bat

if the changed file is wanted open for further check after diff, use the below command.

复制代码
PowerShell -ExecutionPolicy Unrestricted -Command DiffExcel %2 %5 -Open

Set .git/config

add or edit the .git/config file in your repository or your global and amend the following:

复制代码
[diff "excel"]
	command = E:/Code/ExcelBDD/DiffExcel/DiffExcel.bat

Set .gitattributes

复制代码
*.xls* diff=excel

Git Diff Usage

Totally the same as usual git diff, e.g.

复制代码
git status
git diff theChangedExcelFile

Other Output Example

Changed Cells

The -Open is set, the it reminds "The new file is open, please check."

New Worksheet

Missing Worksheet

相关推荐
爱喝矿泉水的猛男2 小时前
Git Commit 提交信息标准格式
git·commit
℘团子এ2 小时前
git中,将新项目推送到新建的远程仓库
git
gitboyzcf2 小时前
Git 常用命令
前端·git·后端
哈里谢顿2 小时前
Git 最实用的四个还原命令详解
git
czhc11400756633 小时前
LINUX 820 shell:shift,expect
linux·运维·excel
大霞上仙15 小时前
实现自学习系统,输入excel文件,能学习后进行相应回答
python·学习·excel
CodeCraft Studio17 小时前
在 Python 中操作 Excel 文件的高效方案 —— Aspose.Cells for Python
python·ui·excel·报表·aspose·aspose.cells
xiAo_Ju17 小时前
git hooks配置
git
Techie峰19 小时前
常见的 Bash 命令及简单脚本
chrome·bash·excel
小妖同学学AI19 小时前
deepseek一键生成word和excel并一键下载
人工智能·word·excel·deepseek