This code using Google Apps Script
It allow you to convert tabular data into JSON. For example:
| A | B |
|---|---|
| 1 | x |
| 2 | y |
will be:
[
{
"a": 1,
"b": "x"
},
{
"a": 2,
"b": "y"
}
]Name of the columns would be lowercased and all non-alphanumerical letters will be replaced to _. Like Some Column would become some_column.
The choice of the using snake case notation is primary for the SQL parity, where table name like someColumn, SomeColumn would be considered as somecolumn unless enquoted with "someColumn".
Be sure that empty cells are omitted.
At this moment there is no configuration, but it is possible to add if it would be needed.
- Open your Sheet
- Click in menu
Extensions→Apps Script - New tab will be open with empty script
- Copy content of the file
export_to_json.gsinto this Apps Script text editor - Rename project name (on top) and script file (
.gs) to a meaningful name. - Click Save button 💾
- Click Execute button ▶
- For the first time you would be asked for permissions to run unknown code, you would need to accept and check checkboxes to allow permission.
If everything is ok you will see logs that script is successfully executed. You can close this window and go back to your Sheet.
You should be able to see in menu new option Export JSON.
Because there is limited permissions, saving it as a file would not be possible, but you will see a popup dialog where you would be able to easily select and copy with Ctrl+C. And then paste into an empty file locally.
If you find any bugs or suggestions, feel free to open an issue, but make sure to provide sample data.