April 10, 2018

Make Git Tower work with Spreadsheet Compare

Posted by Björn Stiel Comments

Git Tower is a graphical user interface-based Git client and an interesting alternative to the command line. Git Tower is very customisable to your individual needs; it supports a set of third party diff tools (such as Beyond Compare) out of the box but you can also make it work with literally any diff tool. This makes Git Tower an ideal tool for version-controlling Excel workbook with Git. In this article, you’ll learn how to configure Git Tower to use Microsoft Spreadsheet Compare as a custom diff tool.

Step 1: Set up a custom diff tool in Git Tower

Git Tower allows you to configure a custom diff tool (for details, check out https://www.git-tower.com/help/win/integration/custom-diff-tools). Create the following file %LOCALAPPDATA%\fournova\Tower\Settings\CompareTools\CompareTool.json:

{
  "DisplayName": "Spreadsheet Compare",
  "SupportsDiffChangeset": false,
  "SupportsDirectoryDiff": false,
  "DiffToolArguments": "\"$LOCAL\" \"$REMOTE\"",
  "ApplicationPaths": [
	"%LOCALAPPDATA%\\spreadsheetcompare.bat"
  ]
}

This calls the bat file %LOCALAPPDATA%\spreadsheetcompare.bat which we’ll create next.

Step 2: Create spreadsheetcompare.bat

Unfortunately, you cannot invoke Spreadsheet Compare directly as its command line arguments are a bit peculiar (looking at you, Microsoft). In order to compare two files with Spreadsheet Compare, you need to create a text file containing two lines: each line referring to the workbook path we want to compare. The path to this text file can then be passed as an argument to Spreadsheet Compare which will diff the two workbooks. Save the bat file below to %LOCALAPPDATA%\spreadsheetcompare.bat:

@ECHO OFF

ECHO %1 > %TEMP%\xldiff.txt
ECHO %2 >> %TEMP%\xldiff.txt
"C:\Program Files (x86)\Microsoft Office\root\Office16\DCF\spreadsheetcompare"  %TEMP%\xldiff.txt

Make sure Spreadsheet Compare is available at the path in the last line of the bat file (the example works for Office 2016, 32bit). That’s it, you’re all set now. Start Tower and in Preferences > Git Config > Diff tool select “Spreadsheet Compare”.

Step 3: Action!

To see Git Tower with Spreadsheet Compare in action, we’ll use https://github.com/ZoomerAnalytics/git-xltrail-examples, but you can obviously use any repository of your liking.

Clone and open the repository with Git Tower, select the head (429ee1ff) and its parent (f9b5dadc) commits and hit the “Diff” button:

Git Tower with Spreadsheet Compare

This opens up Spreadsheet Compare with the diff between the two versions. That’s it, you’re all set now with Git Tower and Spreadsheet Compare.

Any questions or comments, please post below!

Do you want more free Git Excel tips?
About Us
Free Products
Contact Details

Zoomer Analytics GmbH
Eichbühlstrasse 19
8004 Zurich
Switzerland

info@xltrail.com

© 2018 Zoomer Analytics LLC. All rights reserved.