Convert Excel File to JSON / CSV

Use this board to ask questions or have discussions with other Genie users.
Post Reply
kodurivp
New User
Posts: 9
Joined: Tue Feb 04, 2020 3:59 pm
First Name: Varalakshmi
Last Name: Koduri
Company Name: UPMC
Country: United States
Contact:

Convert Excel File to JSON / CSV

Post by kodurivp »

Hi,

Working on file upload widget. Uploaded the xlsx file, trying to convert xlsx file to csv( for that trying to convert xlsx file to json first). Is there any way or properties to handle this scenario?

Please let me know If you have any questions.

Thanks
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: Convert Excel File to JSON / CSV

Post by Scott Klement »

Converting an XLSX to CSV is a non-trivial task. We have nothing like that built-in to Genie, but I do have some ideas that might interest you:

1. You could write a program that uses a tool like POI to convert the Excel document.
2. XLSX documents are zip files that contain a bunch of different XML files as well as stuff like images, etc (if any were used). You could unzip it and read the XLSX file yourself in your program.

Good luck
User avatar
Alex
Profound Logic Staff Member
Posts: 233
Joined: Fri Jan 04, 2008 12:10 pm
First Name: Alex
Last Name: Roytman
Company Name: Profound Logic Software
Contact:

Re: Convert Excel File to JSON / CSV

Post by Alex »

I would look into using Profound.js, along with npm packages like 'xlsx' and/or 'node-xlsx' to accomplish this.

From some of the online posts I am seeing, it could be as simple as:

Code: Select all

const XLSX = require('xlsx');
const workBook = XLSX.readFile(inputFilename);
XLSX.writeFile(workBook, outputFilename, { bookType: "csv" });
But it depends on your needs. I am not sure if one of these packages will do the trick or not.
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests