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
JavaScriptJSON

Avatar of undefined
Last Comment
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.
Avatar of ste5an
ste5an
Flag of Germany image

hmm, I would use XML with an XSLT to HTML instead of CSV.
Avatar of Jimbo99999
Jimbo99999
Flag of United States of America image

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.
Avatar of Jimbo99999
Jimbo99999
Flag of United States of America image

ASKER

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

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Jimbo99999
Jimbo99999
Flag of United States of America image

ASKER

I have been unable to get any of the suggestions to work.  I am still giving it the old boot camp try.
Avatar of Jimbo99999
Jimbo99999
Flag of United States of America image

ASKER

Thank you for the help,
jimbo99999
JavaScript
JavaScript

JavaScript is a dynamic, object-based language commonly used for client-side scripting in web browsers. Recently, server side JavaScript frameworks have also emerged. JavaScript runs on nearly every operating system and in almost every mainstream web browser.

127K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo