Re:Ask HN: What is something you do for clients that consist...
by raverbashing on Monday December 12, 2016 @05:30AM
(#13157082)
How would you export it to xls? ActiveX Excel controller ("in my time this was called COM", etc)? Open source library?
[ Parent
| on HN ]
Re:Ask HN: What is something you do for clients that consist...
by thibaut_barrere on Monday December 12, 2016 @10:00AM
(#13158457)
One 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).
Re:Ask HN: What is something you do for clients that consist...
by Piskvorrr on Monday December 12, 2016 @11:36AM
(#13159353)
This 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.
Re:Ask HN: What is something you do for clients that consist...
by Jugurtha on Monday December 12, 2016 @06:54AM
(#13157405)
For 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/ https://pypi.python.org/pypi/XlsxWriter
[1]: https://openpyxl.readthedocs.io/ https://pypi.python.org/pypi/openpyxl
Re:Ask HN: What is something you do for clients that consist...
by inopinatus on Monday December 12, 2016 @06:10AM
(#13157241)
For 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.
Re:Ask HN: What is something you do for clients that consist...
by rubyfan on Monday December 12, 2016 @08:18AM
(#13157819)
I've had luck with that one too for the times I actually need a real Excel file.
Re:Ask HN: What is something you do for clients that consist...
by karussell on Monday December 12, 2016 @09:09AM
(#13158072)
For Java there are at least two good solutions: https://poi.apache.org/ and https://github.com/plutext/docx4j/ (or JExcelAPI)
Re:Ask HN: What is something you do for clients that consist...
by haldean on Monday December 12, 2016 @11:58AM
(#13159563)
+1 for Apache POI; we actually used that at Google for exporting XLS reports for ads.
Re:Ask HN: What is something you do for clients that consist...
by michaelmior on Monday December 12, 2016 @06:42AM
(#13157366)
tablib[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].
Re:Ask HN: What is something you do for clients that consist...
by rgacote on Monday December 12, 2016 @05:49PM
(#13162784)
I'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
Re:Ask HN: What is something you do for clients that consist...
by michaelmior on Tuesday December 13, 2016 @11:23AM
(#13167966)
Curious if you've tried tablib. I haven't used either, but knowing kenneth_reitz tablib is quality :)
Re:Ask HN: What is something you do for clients that consist...
by dagw on Monday December 12, 2016 @08:20AM
(#13157828)
I'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.
Re:Ask HN: What is something you do for clients that consist...
by tacostakohashi on Monday December 12, 2016 @08:09AM
(#13157766)
HTML table in a file with a .xls extension.
Re:Ask HN: What is something you do for clients that consist...
by rubyfan on Monday December 12, 2016 @08:15AM
(#13157799)
One of my favorite old tricks. Works with renaming a .csv to .xls.
Re:Ask HN: What is something you do for clients that consist...
by JosephHatfield on Monday December 12, 2016 @08:56AM
(#13158018)
Newer 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.
Re:Ask HN: What is something you do for clients that consist...
by jules on Thursday December 15, 2016 @08:06AM
(#13184294)
An 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.
Re:Ask HN: What is something you do for clients that consist...
by Piskvorrr on Monday December 12, 2016 @11:12AM
(#13159086)
PHPExcel 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.
Re:Ask HN: What is something you do for clients that consist...
by geckoquaint on Monday December 12, 2016 @03:30PM
(#13161637)
Note: Last time we used it for large data report generation results were slow and consumed huge amount of memory.
Re:Ask HN: What is something you do for clients that consist...
by Piskvorrr on Thursday December 15, 2016 @02:02AM
(#13182979)
Depends 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.
Re:Ask HN: What is something you do for clients that consist...
by mlangdon on Monday December 12, 2016 @07:42AM
(#13157625)
Most 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.
Re:Ask HN: What is something you do for clients that consist...
by skrowl on Monday December 12, 2016 @07:28AM
(#13157563)
Create it as a report in SSRS, then they can export to XLSX, PDF, CSV, etc
Re:Ask HN: What is something you do for clients that consist...
by wonderwonder on Monday December 12, 2016 @01:36PM
(#13160522)
I've used this a couple of times: http://papaparse.com/