Help required to automate formatting an Excel file
Discussion
I've got a perl script (running on a linux box) that runs some SQL queries against a database, generates a .csv file and then emails this as an attachment.
What I'd like to do is find a way of opening this .csv file in Excel, running a macro on it to sort some columns and format it for printing, and then email out the final file to a number of email addresses.
Can anyone think of a way that this can be done with no user input?
We use Exchange/Outlook 2000 for email, but I can't find any way of setting up a rule to open an attachment in a particular application.
What I'd like to do is find a way of opening this .csv file in Excel, running a macro on it to sort some columns and format it for printing, and then email out the final file to a number of email addresses.
Can anyone think of a way that this can be done with no user input?
We use Exchange/Outlook 2000 for email, but I can't find any way of setting up a rule to open an attachment in a particular application.
Completely automated - i.e., the extract script is cron'd to run on the unix box, .csv file is produced, loaded into Excel where the macro is run, and the resulting file is then emailed out, with the first human contact being when a user sees a perfectly formatted file popping up in their inbox.
Reason for this is that it's going to some senior management who don't want to mess around in Excel every time they get this report.
Reason for this is that it's going to some senior management who don't want to mess around in Excel every time they get this report.
ehasler said:Why not simplify the matter by letting the Linux box generate an already formatted *.csv file, and send it to the final recipeints? Excel will open the csv-file.
I've got a perl script (running on a linux box) that runs some SQL queries against a database, generates a .csv file and then emails this as an attachment.
What I'd like to do is find a way of opening this .csv file in Excel, running a macro on it to sort some columns and format it for printing, and then email out the final file to a number of email addresses.
Can anyone think of a way that this can be done with no user input?
We use Exchange/Outlook 2000 for email, but I can't find any way of setting up a rule to open an attachment in a particular application.
If they just need something fancy to look at and print it (and not working with the data-tables), why not generate a PDF from the csv with Perl?
Hang on, what does this script:
link below said:
=================================================
NAME
Spreadsheet::WriteExcel - Write formatted text and numbers to a
cross-platform Excel binary file.
=================================================
DESCRIPTION
The Spreadsheet::WriteExcel module can be used to create a cross-
platform Excel binary file. Multiple worksheets can be added to a
workbook and formatting can be applied to cells. Text, numbers,
formulas and hyperlinks can be written to the cells.
The Excel file produced by this module is compatible with Excel 5,
95, 97 and 2000.
The module will work on the majority of Windows, UNIX and
Macintosh platforms. Generated files are also compatible with the
Linux/UNIX spreadsheet applications OpenOffice, Gnumeric and XESS.
The generated files are not compatible with MS Access.
This module cannot be used to read an Excel file. See
Spreadsheet::ParseExcel or look at the main documentation for some
suggestions. This module cannot be uses to write to an existing
Excel file.
=================================================
see here: http://search.cpan.org/src/JMCNAMARA/Spreadsheet-WriteExcel-0.33/
Bodo said:
Hang on, what does this script:
[quote=link below]=================================================
NAME
Spreadsheet::WriteExcel - Write formatted text and numbers to a
cross-platform Excel binary file.
I actually found this not long after posting my question, and have already produced my first .xls from Perl! 
Bodo said:Now I've found this Perl module to create Excel files, it's all a piece of cake!
ehasler said:
I actually found this not long after posting my question, and have already produced my first .xls from Perl!
Well then, emailing from scripts shouldn't be too much of a problem with a Linux box, no?!

Gassing Station | Computers, Gadgets & Stuff | Top of Page | What's New | My Stuff


