DEV Community

Cover image for Convert XLSX file into JSON
Michael Willian Santos
Michael Willian Santos

Posted on

3 2

Convert XLSX file into JSON

// start

Hi everyone!
GitHub of the Project


I was working into a PaaS that requires to read a .xls|xlsx file and extract the data into a readable .json, in which will be sent for the database. Seeking around the web, I found the amazing 'mongo-xlsx', however, the data generated was a messy. So, I had the idea to create a package around the 'mongo-xlsx', in which I would use the other package 'string-similarity', to construct a better parse. In the end, it worked as I wanted and needed for the project. Then, I had decide to construct a 'better one' from the one I have built to share with everyone. Please, if you can contribute with pull-requests, do it. I guess that this package can be pretty useful for everyone to use :)


// How To Use

The package is really simple to use. By justing taking a look at the main README.md and the examples, I guess that you guys can see how to use. However, whatever doubt about it, just ask here :)


// Use Case

As given by the example intermediate, the main motive that leads me to create this package, it is an application that I'm making. I had the problem and the needs to convert a lot of .xlsx file into .json one for the Database. The big problem of this, is that the .xlsx was pretty complex (from stock market).

With this package, I could transform that .xlsx file from the cover page, into a .json data. Example:

Alt Text

Sure thing, after it, there is the need to sanitize and so on.


// End

I hope that this package — that will be improved by time, helps someone in their needs. Please, if you can, contribute to the project. I guess that it will help a lot of people xD

API Trace View

How I Cut 22.3 Seconds Off an API Call with Sentry

Struggling with slow API calls? Dan Mindru walks through how he used Sentry's new Trace View feature to shave off 22.3 seconds from an API call.

Get a practical walkthrough of how to identify bottlenecks, split tasks into multiple parallel tasks, identify slow AI model calls, and more.

Read more →

Top comments (2)

Collapse
 
xuri profile image
xuri

I would really recommend trying this library:

github.com/xuri/excelize

Excelize is a library written in pure Go providing a set of functions that allow you to write to and read from XLSX / XLSM / XLTM files. Supports reading and writing spreadsheet documents generated by Microsoft Excel™ 2007 and later. Supports complex components by high compatibility, and provided streaming API for generating or reading data from a worksheet with huge amounts of data.

https://xuri.me/excelize/images/excelize.svg

Collapse
 
daxsoft profile image
Michael Willian Santos

Oh, thank you man! It shall be a huge help

Heroku

Simplify your DevOps and maximize your time.

Since 2007, Heroku has been the go-to platform for developers as it monitors uptime, performance, and infrastructure concerns, allowing you to focus on writing code.

Learn More

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay