How to extract data into excel from a database in unix

Hello viewers,
I am connecting to db2 database from unix. I am executing a query for example
select * from emp.

I need to export the data obtained from the above command to a excel file. Could you please suggest how to proceed on this?

thanks and regards,
k.n.v.santosh

Writing to an Excel file layout is possible, but can be complicated and requires add-ons.
One way many write to Excel is to create csv files. For instance, if you create a file called output.csv:

output.csv

smith,200,10
barry,300,12
harry,12,2001

Excel would read this as a spreadsheet with three rows of data, each row with three columns. Would this accomplish what you want?

Thanks for your posting. This format is fine for me. What can be the approach for this?

thanks and regards,
k.n.v.santosh

For instance, take a look at: