precision-sustainable-ag/Kobo

xls to xml converter

screberg opened this issue · 4 comments

Sarah and I practiced Git and xls forms. Happy with process overall, but having diffs would be extra awesome. Rohit mentioned a converter that would run in our repository. Is this it?
https://gist.github.com/hkuno9000/f9244d923ebf69de11d4

Rohit, can you help us set that up?

I had seen this one that you register as a pre-commit hook.

https://github.com/Agent6-6-6/Excel-VBA-XML-Export-Pre-Commit-Hook

The one that you linked uses a mystery executable with documentation in Japanese, it looks like. This one at least is a Python script that we can inspect.


Never mind!

Looking at the source of the one I linked, it only does XLSX, not XLS.


Edited to add:

But we could use that script more or less, and just replace the Excel parsing library:
https://xlrd.readthedocs.io/en/latest/

Scratch all that. All we need is this Python library:
https://docs.opendatakit.org/xlsform/#id6
https://github.com/XLSForm/pyxform

This library exposes a command line tool, so it looks like there's a single line of code that needs to be in a bash/shell script in the .git/hooks folder:
xls2xform path_to_XLSForm output_path

Excellent! Thanks so much. Do you want to try that out or are you wanting Rohit to give it a whirl?

Based on our Slack conversation, CSV files have more readable diffs than the proper XForm XML, so we're going to upload CSV files instead.

If you're interested in how doing that automatically would work, I made a branch called hooktest, which contains an R script that will be called anytime you run git commit ....