Skip to content

Latest commit

 

History

History
66 lines (42 loc) · 1.91 KB

readme.markdown

File metadata and controls

66 lines (42 loc) · 1.91 KB

Excel Textconv

A script to render an excel (.xlsx) workbook as text suitable to use with diff and, in particular, git diff, to get readable diffs, for example with Git. Inspired by William Usher's git_diff_xlsx which he wrote for working with the UK TIMES model (see his blog). I wrote this in Ruby (using rubyXL) because thats the language of the other UK-TIMES tools

Dependencies

Features

Options to:

  • hide formulas, and show only values (useful for regression testing)
  • hide calculated values for formulas and show just the formulas (useful for git diffs)

Install

On Linux, I create a link called xl-textconv in my ~/bin.

Use

Usage: xl-textconv [options] <workbook-file>
    -v, --no-values                  Exclude calculated values
    -f, --no-formulas                Exclude cell formulas
    -h, --help                       Show this message

Set up Git to use it

See the Git Book

Tell git that files ending xlsx are to be treated as Excel for diff: create .gitattributes file in the root of your repo with the following:

*.xlsx diff=excel

Tell Git how to diff Excel files: in .git/config:

[diff "excel"]
    binary = True
    textconv = xl-textconv -v
    cachetextconv = true

See also This node.js version with some interesting notes on use, including using cachetextconv

Caveat emptor

  • I'm not a Ruby programmer.
  • There are no tests.