Kyle R. Burton on 3 Jul 2008 08:02:10 -0700


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Text file to Excel, automated


On Thu, Jul 3, 2008 at 9:54 AM, Jon Bringhurst <jon@bringhurst.org> wrote:
> How about formatting the result of the query to csv and using
> something like this...
>
> http://sujitpal.blogspot.com/2007/02/python-script-to-convert-csv-files-to.html
>
> On Thu, Jul 3, 2008 at 9:50 AM, Julien Mills <julienfmills@yahoo.com> wrote:
>> I'm looking for a way to put the text output of some
>> sql queries into an excel document which I can email
>> to others in the company.
>>
>> What I do now is run the query, import it into OO,
>> save it as an excel document and then email it.
>>
>> I'd like to automate the whole process.  I believe
>> I can create a .slk file and then excel will read
>> that.  Anyone have any experience doing that or is
>> there a niftier way to do it?

I have used a few libraries for doing this.

Apache Jakarta's POI: http://poi.apache.org/

Perl libraries:
http://search.cpan.org/~jmcnamara/Spreadsheet-WriteExcel-2.21/lib/Spreadsheet/WriteExcel.pm
  Spreadsheet::WriteExcel
  Spreadsheet::WriteExcelFromXML

For Ruby there is spreadsheet-excel, which I've used in a rails app:

  http://rubyforge.org/frs/?group_id=678

All these can run under Linux (or windows), and don't require any
external libraries.  There is even a Java lib for MS Access
files:http://jackcess.sourceforge.net/, as well as a c-library,
mdbtools.  The C library doesn't handle as many cases as the Java
library though (at least not the last time I used it).

Any of those should allow you automate your task...if you're willing,
I'm sure we can even help you work through using any of these over the
list.


Regards,

Kyle
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug