14 ianuarie 2012

Can I have all the database in a spreadsheet please?

If you're a programmer, you were asked for this. Probably several times.

If you're a PHP programmer, you probably ended up using comma separated values for convenience.

My problem: exporting tens of thousands of records from the database to a spreadsheet using PHP.

CSV would be a nightmare for this. It's enough to say new lines, escape characters, the need to set filters when opening, differences between Microsoft Excel and LibreOffice and that fills your plate.


I haven't been able to find a proper library to write OpenDocument spreadsheets using PHP. All the libraries that I found, created the document in memory which is a big no for my problem. So I created a simple library that writes the file directly on the disk. And as a bonus, there's a simple php script that you can use to export directly a query's results to a OpenDocument spreadsheet.

And of course, it's free open source software, download it from here if you need it.

Here's to a good start of my second free project.

1 comentarii: