Skip to content

Bilara io

Blake Walsh edited this page Aug 19, 2021 · 5 revisions

Bilara IO refers to a utility that lives in the .scripts/bilara-io folder.

sheet-export.py exports data from the json to a spreadsheet file. sheet-import.py imports data from a spreadsheet file to json.

Both utilities have help available by calling them with the --help argument.

In general sheet-import.py expects to take a file that has been produced by sheet-export.py and it will update the files.

Create mode

It is also possible to run sheet-import.py in create mode, which creates new files. In this case it needs to be told at what path to create the file or files, this can be done using a config file which will look something like this:

{
  "muids": {
    "comment": "comment",
    "html": "html",
    "root": "root-skt"
  },
  "paths": {
    "comment": "comment/en/",
    "html": "html/skt/sf/",
    "root": "root/skt/sf/"
  }
}

muids defines the suffix of the file, which will be joined with the uid from the filename. The paths define the subfolders within the repo.

For convenience and consistency, it's possible to store configuration in the bilara-io/config folder, and when the -c/--create flag is used but a --config flag is not used, it will look in the config folder for a config file that matches the filename. For example if you are importing a spreadsheet sf276.tsv it would look for a config called either sf276.json or sf.json. Storing the config will help to maintain consistency. It is also possible to explicitly define the config file using the --config flag.

./sheet-import.py sf276.tsv -c