Managing Kobo forms just got so much easier!

If you are someone who manages many Kobo forms, you might want to explore yxf: https://github.com/Sjlver/yxf.

yxf is a tool that converts forms from the XLSForm format to a text-based format. Both versions contain exactly the same information, but text files are a lot easier to store, compare, or bulk-update than spreadsheets.

The text-based format can be converted back into a valid XLSForm file. As a bonus, the result likely looks a lot prettier than the original.

To give an example: yxf allows you to go from this…
original XLSForm

… to this …
YAML version of the form

… and back to this:

This is super cool (in my opinion) because it allows you to treat forms like code. You can now store them using a tool like git, easily compare them, perform bulk changes across many versions of a form, etc. For example, here is a comparison between two versions of a form, after a question has been made required:

yxf is in a very early stage of development. We welcome feedback, bug reports, and contributions. If you find yxf useful, let us know, too :slight_smile:

3 Likes

Thank you for sharing this wonderful piece with the entire community, @Sjlver! It should be very helpful!

@Sjlver, could you also share the command to compare the two forms as shown in the image above?

1 Like

@Sjlver :clap: :clap: :clap:

1 Like

@Kal_Lam To compare two forms, there are many options. In fact, I decided to convert XLSForms to text files precisely because there is such good tooling for text files.

I’ve generated the screenshot above using Visual Studio Code. It can compare two files using the CTRL-SHIFT-P > Compare active file with ... command.

Alternatively, if you have git installed, you can use something like git diff --no-index first_file.yaml second_file.yaml.

Many other tools exist, for example http://meldmerge.org/ or https://winmerge.org/.

3 Likes

Thanks for sharing @Sjlver — this is awesome! :tada:

I also prefer working with text files and created a similar thing using markdown tables so it’s easy to paste the form in the forum or a GitHub issue.

2 Likes

@Josh, that’s really cool!

After looking into your project, I’m considering to add Markdown support to yxf… it could generate Markdown instead of YAML if users specify a --markdown option. In some use cases, Markdown might be better because it is more compact. And for users, it might be better to have a single tool for converting their XLSForm files.

What do you think of that? Would this be OK with you? Could I re-use some of your code (and publish the result under the BSD license that yxf uses)?

3 Likes

Hi @Sjlver, that sounds like a great idea :+1: Feel free to re-use any of it — there’s nothing really special about it as pandas is doing most of the work anyway :grin:

3 Likes

@Josh Check out GitHub - Sjlver/yxf: Convert from XLSForm to YAML and back version 0.2.0

It generates Markdown when the --markdown parameter is specified.

The format is almost the same as yours, except that yxf uses ## survey for the table names instead of %% survey. It understands the %% syntax when reading files, but does not support writing it. The reason is that using headings seemed more natural to me.

Example conversion:
image

## survey

Converted by yxf, from basics-converted.xlsx. Edit the Markdown file instead of the Excel file.

Hello, this is *an emphasized* <u>comment</u>.

| type             | name | label                                                         |
| ---------------- | ---- | ------------------------------------------------------------- |
| text             | name | What is \| your name? Please tell me, I'm **really curious**! |
| integer          | age  | How old are you?                                              |
| select_one foods | food | What is your favourite meal?                                  |

Feedback and bug reports are welcome!

3 Likes

@Sjlver this is great :tada:

1 Like

@Sjlver
This is great work. :slight_smile:

1 Like