介绍一款小巧的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

相关推荐
Violet_YSWY5 小时前
git stash和backup一样吗
git
Crystal32810 小时前
Git 基础:生成版本、撤消操作、版本重置、忽略文件
前端·git·github
系夏普13 小时前
Git 版本库(Ubuntu 环境)
git
Evan芙13 小时前
用fping编写脚本扫描10.0.0.0/24网段在线主机
linux·运维·网络·excel
IT从业者张某某13 小时前
DAY3-Open Harmony PC 命令行适配指南(Windows版)-git Permission denied (publickey) 问题
git·open harmony
摇滚侠13 小时前
零基础小白自学 Git_Github 教程,git 命令行操作1,笔记18
笔记·git·github
无限进步_14 小时前
C++从入门到类和对象完全指南
开发语言·c++·windows·git·后端·github·visual studio
Violet_YSWY15 小时前
git删除某一提交
git
Violet_YSWY15 小时前
git变基
git
MUTA️15 小时前
git常用操作
git