In this tutorial, I'm will show how you can use your own spreadsheet to
export products in JSON format, so that it's easy to import them to Hive Blockchain with Waivio.
Resources:
Full tutorial you can find here
Set up
1. Create or open table in Google Sheets https://drive.google.com/
2. Click on Extensions tab in top menu
3. Click on Apps Script
4. Add name (for example, Export JSON)
5. Delete existing code
6. Copy script code from here
7. Insert code in script editor
8. Click on Save project button
9. Come back to your table and refresh page
10. Now, you should have new tab in top menu.
If the new tab does not appear. Refresh page one more time or you can try to return to the script, add some comment(// comment), save again, return to the table and refresh page. Usually, when the page loads, the new tab appears later.
Add template to Google Sheets
Open google template with fields and copy to your table.
You need to freeze the first row (View -> Freeze -> 1 row). This is important as this is the name of the fields to be exported.
Permission
1st time after clicking on "Export JSON for this sheet" you need to give permission to the script.
1. Click Export JSON
2. Click Export JSON for this sheet
3. You will see Authorization Required modal window
4. Click Continue
5. Complete authorization and give permission
6. Click Export JSON one more time
7. You should see notification Running script and modal window with json
Exported JSON
"Exported JSON" modal window has:
direct link to download the file, leads to your google drive;
json - that was created by script.
Every time when script is running, file is created on your Google Drive. Even if you edit the same table, every time file will be created. So, don't forget to delete unnecessary files from your Google Drive that were created in this way.
Table fields
1st line of the table - these are the names of the fields, each next is a separate object:
2nd - object #1
3rd - object #2
4th - object #3
etc.
Below, table of all fields from the template.
Quick summary: Pay attention to fields:
- categories, imageURLs - because different items should be separated by ";"
- features - format for recording: key: Feature Name; value: Feature description*, key from value must be separated by ";", each feature must be separated by "*"
- waivio_tags - format for recording: key: Tag category; value: Tag*, key from value must be separated by ";", each line must be separated by "*".
Fields
1. asins
The ASIN (Amazon identifier) used for this product.
Field type: string
2. brand
The brand name of this product.
Field type: string
3. brandLink
The permlink to existing business object.
Field type: string
Permlink is a unique object identifier. Can be seen in the link.
4. categories
A list of departments where the product can be found.
Each department must be separated by ";".
There is no need to put a ";" after the last department.
Field type: array
In order to successfully import objects such as a book and a restaurant, the relevant department must be in the list of categories (Books, Restaurant).
5. brand
The brand name of this product.
Field type: string
6. colors
A list of colors available for this product.
That will be options with "Color" category name.
Only one color option can be added.
Field type: array
7. dateAdded
The date this product was first added.
Field type: date
8. dateUpdated
The most recent date this product was updated.
Field type: date
9. descriptions
The description for this product.
Field type: nested
10. dimension
The length, width, and height of this product. Units included.
Field type: string
11. dontFetchAmazonOptions
If you fill in the value of this field as true, then the options will not be pulled from Amazon but will be taken from the table. In the file it will look like:
12. features
A list of features associated with this product.
The feature list can be collected from specific feature sections available on product listings for the product. Format for recording features:
key: Feature Name; value: Feature description*
Key from value must be separated by ";".
Each feature must be separated by "*".
Field type: nested
13. groupId
The Group ID used for this product.
Field type: string
14. imageURLs
A list of image URLs for this product.
Each url must be separated by ";".
There is no need to put a ";" after the last url.
Field type: array
15. isbn
The ISBN code for this product.
Field type: string
16. manufacture
The manufacturer of this product.
Field type: string
17. manufacturerLink
The permlink to existing business object.
Field type: string
Permlink is a unique object identifier. Can be seen in the link.
18. merchants
The merchant name of this product.
Field type: nested
19. merchantLink
The permlink to existing business object.
Field type: string
Permlink is a unique object identifier. Can be seen in the link.
20. mostRecentPriceAmount
The product's most recent price amount scraped.
Field type: float
21. mostRecentPriceCurrency
The currency listed for mostRecentPriceAmount.
Field type: string
22. name
The product's name.
Field type: string
23. primaryImageURLs
The product's avatar.
Field type: array
24. sizes
A list of sizes available for this product.
That will be option with "Size" category name.
Only one size option can be added.
Field type: array
25. waivio_options
A list of options with all fields for options for the product. Format for recording options:
category: Options category; value: Value; position: 1; image: "https://imagelink"*
Every field must be separated by ";".
Each option must be separated by "*".
One option has 4 fields: category and value are required.
Field type: nested
26. waivio_tags
A list of tags with tag categories associated with this product. 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
27. weight
The weight of the product. Units included.
Field type: string
Recommendation
- Use Google account when you don't have important files - because, every time when script is running, a file is created on your Google Drive. So from time to time you will need to clear the space. (Script running after you click "Export JSON for this sheet").
- In order to successfully import objects such as a book and a restaurant, the relevant department must be in the list of categories (Books, Restaurant).
- Do not use ";" as a value in the field, if its categories, colors, features, sizes, waivio_tags because it is a separator for these fields. Use only as separator.
- Do not use "*" as a value in the field, if its features, waivio_tags because it is a separator for these fields. Use only as separator.
- Don't change field names in first row, because there are correct field names.
- Don't change field order and don't delete columns, because the script is guided by the location index.
- It is not necessary to fill in all cells. Empty cells will be skipped.