mail a csv file as an excel sheet!

Hi,

The result of a script is a csv file in the following format:

cat $file_name
DATA_USAGE_FACT,YES_NO_FLG,TARGET_TABLE,YES_NO_FLG,1,0,15,0
DATA_USAGE_FACT,DATE_OF_CREATION,TARGET_TABLE,DATE_OF_CREATION,29,9,19,0
DATA_USAGE_FACT,UPDATION_DATE,TARGET_TABLE,UPDATION_DATE,29,9,19,0
DATA_USAGE_FACT,INSTALLATION_DATE,TARGET_TABLE,INSTALLATION_DATE,29,9,19,0
DATA_USAGE_FACT,ASSET_CODE,TARGET_TABLE,ASSET_CODE,15,0,3,0

which I want to send in an excel sheet. What I'm doing is

 
unix2dos $file_name | uuencode $file_name $file_name.xls | mailx -s "Usage Sheet" <mail_id> 

And though I get the above .xls sheet as an attachment in the mail; still the data inside it is in csv format only. It doesn't come in separate cells as intended.
I even tried

 
unix2dos $file_name > $file_name_dos
uuencode $file_name_dos $file_name_dos.xls | mailx -s "Usage Sheet" <mail_id>

but to no avail.

I've searched the forum and came accross a reverse requirement

there the csv data was actually coming in separate cells!!:confused:

Please advice.

-dips

Use ';' instead of ',' in your csv file. In your locale the comma is the decimal separator and Excel can't use it as a field separator.

It's not working!! :frowning:

With the original approach i.e. while using "," comma as delimiter I could manually convert .csv file to .xls by using "Text to Columns" option available in excel. But it doesn't get converted to an excel sheet when opened.

-dips

XLS is a proprietary binary format, developed and distributed by Microsoft alone. There's no default UNIX tool that can convert a CSV (text format) to XLS automatically. One way to do what you want would be to create a script based on Spreadsheet::WriteExcel to convert your data.

Also, if you had used the sites search feature, as suggested in the rules, you'd have found a lot of threads dealing with the issue. Thus: Thread closed.