Recipe export template from Google Sheets to JSON - Waiviogit/waivio GitHub Wiki
- Create or open a table in Google Sheets by visiting Google Drive.
- In the top menu, click on the Extensions tab.
- Select Apps Script.
- Give your project a name (e.g., "Export JSON").
- Delete any existing code in the script editor.
- Copy the script code from here.
- Paste the code into the script editor.
- Click the Save project button.
-
Return to your table and refresh the page.
-
You should now see a new tab in the top menu.
If the new tab does not appear, refresh the page once more. Alternatively, you can return to the script, add a comment (e.g., // comment), save it, then return to the table and refresh the page. Typically, the new tab will appear after the page loads.
-
Open the Google template containing the fields, and copy them to your table.
-
Freeze the first row by going to View -> Freeze -> 1 row. This is important because the first row contains the field names that will be exported.
The first time you click "Export JSON for this sheet," you'll need to grant permission for the script to run.
- Click Export JSON.
- Select Export JSON for this sheet.
- An "Authorization Required" modal window will appear.
- Click Continue.
- Complete the authorization process and grant the necessary permissions.
- Click Export JSON again.
- You should see a notification indicating that the script is running, followed by a modal window displaying the JSON.
The "Exported JSON" modal window contains:
- A direct link to download the file from your Google Drive.
- The JSON data generated by the script.
Each time the script runs, a new file is created in your Google Drive. Even if you edit the same table, a new file will be generated. Be sure to delete unnecessary files from your Google Drive periodically to manage your storage.
The first row of the table contains the field names. Each subsequent row represents a separate object:
- The 2nd row corresponds to Object #1.
- The 3rd row corresponds to Object #2.
- The 4th row corresponds to Object #3. and so on.
Below is a table of all fields from the template.
Field Name | Example Value | Description |
---|---|---|
fieldBudget |
![]() |
The recipe budget information. Field type: string. |
fieldCalories |
![]() |
The recipe calories information. Field type: string. |
fieldCookingTime |
![]() |
The recipe cooking time information. Field type: string. |
fieldDescription |
![]() |
The description for this object. Field type: string. |
fieldRecipeIngredients |
![]() |
A list of recipe ingredients. Each ingredient information must be separated by ";". There is no need to put a ";" after the last URL. Field type: array. |
imageURLs |
![]() |
A list of image URLs (gallery items) for this link. Each image URLs must be separated by ";". There is no need to put a ";" after the last URL. Field type: array. |
listAssociations |
![]() |
Permlinks of lists where the user wants to add the imported object. A permlink is a unique part of the list URL, typically found between /object and the page part of the URL. For example, in the URL https://www.waivio.com/object/34mfdx-essentials/list, the permalink is 34mfdx-essentials). Each permlink must be separated by ";". There is no need to put a ";" after the last URL. Field type: array. |
name |
![]() |
The object's name. Field type: string. |
primaryImageURLs |
![]() |
The object's avatar. Field type: array. |
waivio_product_ids |
![]() |
A list of product IDs with value associated with this recipe. Format for recording tags: key: Product ID type; value: Value* Key from value must be separated by ";". Each product ID must be separated by "*". Value can have only one option. Field type: nested |
waivio_tags |
![]() |
A list of tags with tag categories associated with this recipe. Format for recording tags: key: Category Tag Name; value: Tag* Key from value must be separated by ";". Each tag must be separated by "*". Value can have only one option. Therefore, in order to add several tags to one category tag, they need to be recorded separately. Field type: nested |
- Use a Google account when you don't have important files stored there. Each time the script runs, it creates a file on your Google Drive, so you'll need to clear space periodically (the script runs after you click "Export JSON for this sheet").
- Do not change the field names in the first row, as they are already correct.
- Do not change the field order or delete columns, as the script relies on the location index.
- It is not necessary to fill in all cells. Empty cells will be skipped.