This PHP script will export your iCloud bases groups and sheets to disk, while keeping their hierarchical structure intact. So, group can be in groups, which can be in groups, etc. Ulysses actually has the ability to do something very similar by clicking on a group in the app and then dragging the group to the finder. However, I wanted the ability to automate the process, so that I could use git to version and control my writing. However, I wanted to use iCloud and not external sources.