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…
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:
@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.
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)?
Hi @Sjlver, that sounds like a great idea Feel free to re-use any of it — there’s nothing really special about it as pandas is doing most of the work anyway
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:
## 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? |