4 ms·
Pure JS in-browser Excel file parser
- davidbanham 13y agoLooking at all the special casing in your code, just for dates, I can imagine the sweat and tears that have gone into producing this. For anyone else looking for the code as I was, it's here: https://github.com/SheetJS https://github.com/SheetJS https://github.com/SheetJS/js-xlsx https://github.com/SheetJS/js-xlsx https://github.com/SheetJS/js-xls https://github.com/SheetJS/js-xls
- sheetjs 13y agoThe date processing is one of the worst-documented features, and there are conflicts in the documentation between MS-XLS (XLS files), ECMA-376 (the office open xml standard), and MS-XLSX (describing how excel deviated from ECMA-376 -- yes, this exists and is pretty substantial). To give an example, in some versions of excel `e` refers to the "era", which is the year for US versions. However, the documentation and individual implementations disagree as to what they actually mean: Some versions treat "e" as the 4-digit year and "ee" as the 2 digit year. Other versions treat "e" and "ee" as the 4-digit year. Others treat "e" and "ee" as the 2-digit year But the worst offender is format code 14, which actually depends on the client calendar type, so you get different results in different versions of excel
- jsmeaton 13y agoI broke it http://imgur.com/dBKulsK http://imgur.com/dBKulsK It first generated about 6 rows. I scrolled my mouse, it generated the rest. I clicked around and scrolled a bit more, and the table moved around the page, finally settling at the bottom of the page, losing my scrollbars for the page. Chrome Version 31.0.1650.48 beta
- sheetjs 13y agoThere are some deeper issues with the grid component -- it's what I deserve for not building it myself :/ The interactive demos http://sheetjs.github.io/js-xlsx http://sheetjs.github.io/js-xlsx and http://sheetjs.github.io/js-xls http://sheetjs.github.io/js-xls just show CSV output, which may be easier to use if the grid is flaking
- webXL 13y agoMight not be totally relevant here, but I highly reccomend Handsontable for rendering/manipulating spreadsheets client side: http://handsontable.com http://handsontable.com Edit: In fact I'm headed home right now to integrate your lib with that if no one has already beat me to it!
- sixQuarks 13y agoThis is faster than Excel itself.
- gliese1337 13y agoSweet! A few years ago I had to write a bunch of JavaScript code for manipulating Excel spreadsheets running in the Windows Scripting Host environment (https://github.com/gliese1337/PhoneReport); https://github.com/gliese1337/PhoneReport); WSH exposes an API for poking Excel from JScript, so I used that, but it makes the code very non-portable- it'll only run on Windows machines with IE and MSExcel installed. This could be really useful for genericizing it. Does it support writing Excel files, or just reading?
- sheetjs 13y agoRight now it's just reading. My approach is to attack reading first because it is the harder problem (and exposes more features that need to be represented in the internal format). Once I'm confident I've covered what needs to be represented, then writing is easy. Honestly, the biggest challenge here is trying to understand the full scope of the problem -- its huge!
- headgasket 13y agokudos. This is something on which bridges will be built for the corporate world.
- motyar 13y agoNice! Please add a "Upload" button too.
- sheetjs 13y agoThis is hosted on github (https://github.com/sheetjs/sheetjs.github.io https://github.com/sheetjs/sheetjs.github.io) so I can't directly do it from there. If you want to see an example using AJAX, the browser stress test (http://oss.sheetjs.com/stress.html http://oss.sheetjs.com/stress.html) downloads files. DO NOT RUN ON YOUR PHONE -- THIS WILL DOWNLOAD MORE THAN 80MB!
- sillysaurus2 13y agoThe guy behind this is a brilliant hacker who has been working on this for a long time. He also has a keen business sense. Anyone who's interested in partnering with him should shoot him an email.
- pvnick 13y agoThis is really, really cool. I've been developing an excel spreadsheet that I use for diet/nutrition tracking, which has all sorts of calculations across various sheets. I thought there was no way this would be able to handle that, but I was very impressed to see it handled it like a champ.
- sheetjs 13y agoIf anyone from GitHub is reading this: People are reporting 503 Backend is unhealthy: "Error 503 Backend is unhealthy Backend is unhealthy Guru Meditation: XID: 2049396566 Varnish cache server"
- hackula1 13y agoAwesome. Excel, PDF, and SQL Server are the 3 most obvious proprietary integrations that have an enormous demand in javascript for commercial application devs. There are partial solutions for each, but anyone who has worked with them knows that they are miles away from the .Net and Java equivalents. Most of the current solutions are clunky, have onerous dependencies, or simply do not implement the common features that most people need. Keep up the good work, and I hope this encourages similar projects! These types of things are far from sexy in most of the web world, but turn heads in the B2B space.
- gokulk 13y agovery nice. Wish I had this a couple of months back :). I had to spend a few days with zip.js and async.js to get something like this and it accepted only xlsx files.
- niix 13y agoThe developer of this project is an amazing dude and brilliant programmer.
- simantel 13y agoGlad to see this on HN! I just found SheetJS on Friday when I was looking for an XLS/XLSX to JSON solution. Keep up the good work!
- binarydreams 13y agoIt is indeed quite lovely, I've even written a post on it recently - http://codetheory.in/parse-read-excel-files-xls-xlsx-javascript/ http://codetheory.in/parse-read-excel-files-xls-xlsx-javascr...