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 differ only in their default configuration: xls2txt and xls2csv both return one row per line, however xls2txt separates cells with a TAB character by default while xls2csv uses a comma (,): 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
    

Thanks