pyxform is a Python library that makes writing XForms for ODK Collect and Enketo easy by converting Excel spreadsheets into XForms. It is used as a library in a number of tools including the XLSForm Online and XLSForm Offline.

Running pyxform from command line

For those who want to convert forms at the command line, pyxform can be installed directly from the command line using pip:

$ pip install pyxform

The xls2xform command can then be used:

$ xls2xform path_to_XLSForm output_path


Moving quickly from XLSForm to a device

Use pyxform together with adb to quickly convert an XLSForm and load it to a device.

Once you have both tools installed, convert and push in a single line:

$ xls2xform form-name.xlsx form-name.xml && adb push form-name.xml /sdcard/odk/forms/form-name.xml

For even more efficiency, you can save a lot of typing by adding a few lines to your .bash_profile.

x2x () { xls2xform "$1.xlsx" "$1.xml" ; }
pf () { adb push "$1.xml" "/sdcard/odk/forms/$1.xml" ; }
xlpf () { x2x "$1" && pf "$1" ; }

Then, from the command line:

# To convert a form.
$ x2x form-name

# To push a form.
$ pf form-name

# To convert and push at once.
$ xlpf form-name