xls2txt: converting spreadsheets to text

Purpose

xls2txt and xsl2csv allow converting spreadsheet files to text for compatibility with terminals and command-line utilities (e.g. diff or less). Despite the name, they should work with both excel (xls, xlsx or xlsb) and OpenDocument (ods) files.

The two executables provided by this package broadly work the same way, returning one line per row separated by a unix newline (\n) and quoting field values if necessary, they differ only in their default field (cell) separator:

The tab separator seems like a better default for readability and compatibility with various unix utilities.

Interface

Both utilities have the same parameter and options, differing only by their default:

Recipes

git text conversion

This allows viewing textual diffs of spreadsheet files using git log or git diff rather than get an unhelpful "binary files differ":

  1. create a $HOME/.gitattributes file, or set an arbitrary file as the attributes file (git config --global core.attributesFile <filename>)
  2. in that file, associate the relevant spreadsheet extensions with the proper category (hunk-header):

    *.ods diff=spreadsheet
    *.xls diff=spreadsheet
    *.xlsx diff=spreadsheet
    *.xlsb diff=spreadsheet
    
  3. set xls2txt (or xls2csv), possibly configured as you desire, as the diff text converter:

    git config --global diff.spreadsheet.textconv xls2txt
    

Changelog

1.1.0

1.0.2

1.0.1

Thanks