HTML data export in EXCEL

Hi, I have created small APP to build configuration details based on few inputs which will provide two column of output in html. i would like this to have exported in excel file with some href icon or as a default option…

Need some advice over here please.


You have two basic options - you can create an Excel file on the server in a view to be generated and downloaded as a result of a button-push, or you can create the Excel file in the browser using JavaScript.

So first you want to decide where you want to create this file and then you can select an appropriate library to help you do it.

Thanks Ken for prompt support.

My requirement is to give output on excel so that end user can use it better. My current html output looks as follows. Kindly assist on suitable method.


Your first decision is to choose between doing this in JavaScript in the browser, or in a view on the server.

Everything else follows from that.

Dear Ken

Will go with javascript. Kindly assist further how this can be achieved

The next step is to find a library that you’re comfortable with that will do what you want. There are a number of different libraries available to do this.

SheetJS is perhaps one of the better-known ones. There are others - some searching around will help you locate them.

I don’t have any specific recommendations - the only time I do any exporting of data to an xlsx file is from datatables, which has its own mechanism for handling that.

Maybe someone else with more direct knowledge will jump in here with other recommendations.

Dear Ken,

Actually i am not exporting the data from tables to excel; instead i have populated some output on html which is based on some value on existing table fields, and i need this data to be exported into excel.


Right. That’s where SheetJS can help you. (Or any of the other available alternatives.)