Skip to content

Instantly share code, notes, and snippets.

@jsmithdev
Last active October 9, 2017 18:58
Show Gist options
  • Select an option

  • Save jsmithdev/bcbc8c5c4a3c0452213b4010b242ab6a to your computer and use it in GitHub Desktop.

Select an option

Save jsmithdev/bcbc8c5c4a3c0452213b4010b242ab6a to your computer and use it in GitHub Desktop.
const fs = require('fs')
,converter = require('json-2-csv')
,request = require('request')
//REPLACE WITH WANTED URL
,url = 'https:// [YOUR CREDS @ YOUR STORE] .myshopify.com/admin/products.json'
;
request(url, (error, response, body) => {
if(response.statusCode === 200){
const data = JSON.parse(body);
converter.json2csv(data.products, (err, csv) => err ? console.error(err) : fs.writeFileSync('report.csv', csv))
}
else {
console.error(error)
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment