How to import a lot of Excel data using Javascript and display as formatted html?
Feb.27, 2008 in
Other
gauravbphh asked:
I am not sure if my approach is in anyway correct, but I have a massive load of data in Excel I need to display as formatted html (including some hyperlinks), can anyone please give me some help on this ?
I am a total novice in Javascript, will a loop function do the trick in reading the data and display it ?
Thanks a million
Tags: Excel Data, Hyperlinks, Javascript Function, Javascript Html, Javascript Loop, Lot, Massive Load, Novice, Thanks A Million
Custom Search
February 28th, 2008 at 8:43 pm
Sure, you could use a loop function. And you’re going to loop through what, exactly? Rows and columns in an Excel file? Too bad JavaScript can’t read Excel files. Also too bad that even if it could, it would be the worst possible way to do it. JavaScript is parsed by the client. Meaning everyone who visits your website has to download your page, download the Excel file (probably embedded in an IFrame), then let the JavaScript run and parse the Excel to HTML. Then 3 days later when it’s done, they can finally view the site. JavaScript can’t read Excel files – proprietary binary format. Excel files/data cannot be embedded in a web page – not a format that can be read by browsers.
To do this, you would use a server-side scripting language. PHP, ASP, whatever. You’d have to find some way to get them to read the Excel file too. PHP has a few classes around for reading Excel (eg. PHPExcelReader). Also, you could use an Excel ODBC connector, they come installed with office. Your web server will need to have one installed.
And then there’s the fact using Excel to drive content on a website is inefficient and stupid. If you need to store data, use a database. That’s what they’re made for. That’s why 99% of dynamic websites use one. Even using an Access file would be better if you need something pretty and usable by idiots.