You can easily create Excel spreadsheets in Node.js by using the GoodGrids CSV to Excel conversion API. You can use any HTTP client library you are comfortable with. In this example, we will use request, which you can install using:
npm install request@2.81.0
var request = require('request');
var fs = require('fs');
request({
method: 'PUT',
preambleCRLF: true,
postambleCRLF: true,
uri: 'https://api.goodgrids.com/api/convert/v1/csv-to-excel/3a6c0d9ac7c74d',
multipart: [
{
'content-type': 'text/csv',
body: fs.createReadStream('to_convert.csv')
}
]
},
function (error, response, body) {
if (error) {
return console.error('upload failed:', error);
}
// we got the Excel spreadsheet contents in the body
});
Make sure to set uri
to the API URL of the GoodGrids CSV-to-Excel conversion configuration you want to use.
Found a bug? Have a suggestion on how to improve this documentation? Please send us a note at support@goodgrids.com.