Creating products from csv
Whenever dealing with static table data, it's easier to export it as a csv file than going through the trouble of reading the xlsx file or connecting to a live spreadsheet. The purpose of this quick guide is to provide a code example on how to transform the .csv file into a json file that can be used to create product in the platform.
Code Example
Node
CSV Data Example
In this example we are creating a JSON file containing the 2 products contained in this data set. We are tagging them as fabric and adding a dynamic metadata fields and the keyword based on one of the columns. They can then be used as a part attribute on another catalog item which will serve as the main configurator. The script can be adjusted to your particular needs and data structure. Once you have written the file, you can use the import function on the catalog or the Product Import API.
If the 3D assets are already set up in the asset library, you might also find useful using the following function to get a list of 3D assets, find the proper match using a naming convention or looking for metadata, and use their assetId as part of the product JSON.
The JSON list you get from this function has the same schema as the product JSON. Example: