5 ms·
How would you export it to xls? ActiveX Excel controller ("in my time this was called COM", etc)? Open source library?
by raverbashing 10y ago
How would you export it to xls? ActiveX Excel controller ("in my time this was called COM", etc)? Open source library?
- inopinatus 10y agoFor anyone using Ruby I'd recommend the (open-source) axlsx gem, I've had great results being able to treat Excel generation like I'm rendering a view.
- rubyfan 10y agoI've had luck with that one too for the times I actually need a real Excel file.
- michaelmior 10y agotablib[0] is one option for Python. There are quite a few libraries that handle export. Excel files (and other Office) file formats are just zip files containing XML. For a while now, this has been an open standard[1]. [0] https://github.com/kennethreitz/tablib https://github.com/kennethreitz/tablib [1] https://en.wikipedia.org/wiki/Office_Open_XML https://en.wikipedia.org/wiki/Office_Open_XML
- deleted 10y ago[deleted]
- rgacote 10y agoI've found the Python pyexcel library to be the most flexible option to read/write Excel files. https://pypi.python.org/pypi/pyexcel/0.0.9 https://pypi.python.org/pypi/pyexcel/0.0.9
- michaelmior 10y agoCurious if you've tried tablib. I haven't used either, but knowing kenneth_reitz tablib is quality :)
- Jugurtha 10y agoFor Python, there's XlsxWriter[0] (creation of new excel files) and OpenPyXL[1] (creation of new and manipulation of existing files). [0]: http://xlsxwriter.readthedocs.io/ http://xlsxwriter.readthedocs.io/ https://pypi.python.org/pypi/XlsxWriter https://pypi.python.org/pypi/XlsxWriter [1]: https://openpyxl.readthedocs.io/ https://openpyxl.readthedocs.io/ https://pypi.python.org/pypi/openpyxl https://pypi.python.org/pypi/openpyxl
- skrowl 10y agoCreate it as a report in SSRS, then they can export to XLSX, PDF, CSV, etc
- mlangdon 10y agoMost reasonably popular languages will have platform-independent open source read-write libraries for Excel. I've used the Python version of this with minimal pain.
- tacostakohashi 10y agoHTML table in a file with a .xls extension.
- rubyfan 10y agoOne of my favorite old tricks. Works with renaming a .csv to .xls.
- JosephHatfield 10y agoNewer versions of Excel will warn the user of possible file corruption if they try to open an .html file that has been renamed to .xls. The file can still be opened but the warning is bothersome.
- jules 10y agoAn alternative is to make a .xlsx file with Excel, then unzip it. You'll get a folder with text files and then you'll see how to generate your own.
- karussell 10y agoFor Java there are at least two good solutions: https://poi.apache.org/ https://poi.apache.org/ and https://github.com/plutext/docx4j/ https://github.com/plutext/docx4j/ (or JExcelAPI)
- haldean 10y ago+1 for Apache POI; we actually used that at Google for exporting XLS reports for ads.
- dagw 10y agoI've used openpyxl a lot for these kinds of tasks, and found it really useful. One nice feature with openpyxl is that it can work together with excel template files. So I can create a template in excel with whatever looks and features I want and then use openpyxl to populate those templates with data.
- thibaut_barrere 10y agoOne useful trick is that you can rely on the headless version of LibreOffice to do the conversion, here on Mac for instance (but also work on Ubuntu with a slightly different call): /Applications/LibreOffice.app/Contents/MacOS/soffice --headless --convert-to xlsx file.csv Note, though, that some conversion errors can still occur (I've seen one personally a long time back).
- Piskvorrr 10y agoThis works for many other formats, too: anything to PDF, for example. A resource hog, though - had to close it off into its own container, lest it gobble up all available RAM.
- Piskvorrr 10y agoPHPExcel for, you guessed it, PHP. An order of magnitude less hassle than CSV ("the files you generate are wrong, but only on some computers! Fixitfixitfixit!!!"), and surprisingly powerful.
- geckoquaint 10y agoNote: Last time we used it for large data report generation results were slow and consumed huge amount of memory.
- Piskvorrr 10y agoDepends on the amount of data, calculations, and formatting. For "output this array of arrays as XLSX instead of CSV", I find its current performance acceptable.
- wonderwonder 10y agoI've used this a couple of times: http://papaparse.com/ http://papaparse.com/