How to export Result to Excel Tabular format from UNIX?

Hi I am working on a script in which I am firing a query on database through Unix and getting the result set. I want to export that in an excel file. I am able to do so nut the result are exported horizontally one below the other. Can anyone plss help me out in exporting the Result in Tabular format in excel through Unix
?

The best way is to create a CSV-format: the fields are separated by semicolon (";"). Looks like this:

row1field1;row1field2;row1field3
row2field1;row2field2;row2field3
row3field1;row3field2;row3field3

This is easy to accomplish using standard SQL and can be imported in Excel without problems.

I hope this helps.

bakunin

Thank You.. I will try using this.

If you are using mysql or psql you can format the output of your query in csv format.
And any spreadsheet software would allow you to open csv file.
Once you open that file in excel spread sheet you can do some changes manually.

Just a note: if dealing with the dates, I found that Excel accepts YYYY/MM/DD format without a hickup.