@comicrelief/shopify-csv
v1.3.1
Published
Prepare products for importing into Shopify
Keywords
Readme
Shopify CSV tool
A command-line tool to help prepare products for importing into Shopify.
Product details are entered by several teams into a spreadsheet that has been designed to match Shopify's requirements. See the Online Shop pages on Confluence for previous years' product sheets.
Once product names and SKUs have been entered, the Tech team is responsible for assigning product handles and other mandatory fields. We then need to export a CSV file suitable for importing into Shopify.
This is still quite a time-consuming task, as some fields need to be filled in for every variant, some for only the first row of a product, etc. We also have to check that the sheet has been filled in correctly. Then, when it comes to exporting, Excel lets you export only one sheet at a time, and we usually have 3 or 4 as a way of grouping products from different partners.
shopify-csv automates most of this. We still need to assign the product handles manually, but it will fill in all the other required fields and run validation. It then outputs a single CSV file containing rows from all sheets.
Usage
Install from npm:
npm i -g @comicrelief/shopify-csvPass the product sheet Excel file to the CLI to generate a CSV file. You can optionally specify the CSV file path with -o.
shopify-csv [-o products.csv] path/to/products.xlsxYou can then import this into Shopify by following their docs for Importing products with a CSV file.
Note that the CLI doesn't just support Excel files – LibreOffice Calc or Apple Numbers work just fine too. For a full list of supported formats, see the SheetJS docs.
Development
Linting
Check for consistent code style by running npm run lint.
Testing
Run all tests using npm test, or npm run coverage to see test coverage.
SheetJS
We use SheetJS (the xlsx package) to read spreadsheet files. Unfortunately, the maintainers no longer publish updates to npm and are not being very helpful about it (see this issue). The most recently published version is now 4 years old and has several security vulnerabilities.
So that we can continue to have the convenience of npm (including security audits), this repo has been switched to a community-maintained mirror of SheetJS's self-hosted package, republished onto npm. In the longer term we should look for an alternative library.
