Link to home
Start Free TrialLog in
Avatar of Jimbo99999
Jimbo99999Flag for United States of America

asked on

Export JSON data to Excel

Good Day Experts!

I am working on a project for my landscaping business and need a little bit of direction.  It utilizes node/express/sequelize/mySQL.  The user input saving to the database is working great.  I have JSON data displaying based on user selection of search criteria.   I have the JSON data exporting to a CSV file.   I would like to format the heading and data rows so they look presentable.  I am guessing I have to switch to creating an actual excel workbook.

I have been searching the net for how to achieve output to an excel workbook.  Unfortunately, I have not had any success just trying to create an excel workbook.   Could you point me the direction ?

Thanks,
jimbo99999
Avatar of Noah
Noah
Flag of Singapore image

Hi there! :)

I'm not sure since I need some data but you can try this converter as a start. It might be able to convert your data to look more presentable.

Reference: http://www.convertcsv.com/json-to-csv.htm
Avatar of Norie
Norie

jimbo99999

I've not tried it myself but perhaps you could take a look at exceljs.
hmm, I would use XML with an XSLT to HTML instead of CSV.
Avatar of Jimbo99999

ASKER

Hello

Thanks for the replies.  I have been trying all 3 but not having any luck.  I am going to circle back to the exceljs and try that again.
Well, I was able to get it working kind of.

If I have all of the spreadsheet generating code in my server.js file it works great.  If I have 1) at the top of the server.js file and 2) behind the button click in my view.js file I get the error --> "Uncaught ReferenceError: Excel is not defined"

If I have 1) and 2) behind the button in my view.js file I get the error --> "Uncaught ReferenceError: require is not defined"

1) var Excel = require('exceljs');
2) var workbook = new Excel.Workbook();

Can you offer insight in what I am missing?

Thanks,
Ed
ASKER CERTIFIED SOLUTION
Avatar of Norie
Norie

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I have been unable to get any of the suggestions to work.  I am still giving it the old boot camp try.
Thank you for the help,
jimbo99999