Adding Tab to excel Sheet

Hi,

I have 2 sets of data in two different files,say f1 and f2.

I want to create a excel sheet with two tabs whose names will be set at run time(different from excel name)
in a shell script, and the data will be written into those two tabs at run time.Any command in UNIX doing so?

I am able to generate the xls but with one tab only.Also the tab name is same as that of the excel sheet.

Help will be appreciated.

How are you generating the excel sheet?

cat f1 > file1.xls
where f1 is the file name and file1.xls is the xls .
I want to create another tab in file1.xls and add the content in f2 to it.

Er... and how is f1 created, then? If it's not an Excel spreadsheet, neither is file1.xls, since cat isn't a magic flat-file-to-excel converter -- all you're doing is copying it!

If you want to do anything more complex than Excel importing a flat file, you'll need to use something that actually understands how xls works, like Spreadsheet-WriteExcel-2.40 - Write to a cross platform Excel binary file - metacpan.org

1 Like

To make it easier to understand,my question is:

Is it possible to create an excel with 2 tabs using any unix command?
If yes, what are the ways(s)?

what do you mean with "2 tabs"?

There's no magic convert_flat_file_into_excel_spreadsheet_with_tabs command, no. As I already said, you'll have to use something like a perl module which understands how to write excel spreadsheets. Please read and explore the link I gave you, it comes with examples.

You still haven't told me what f1 is.

---------- Post updated at 09:32 AM ---------- Previous update was at 09:31 AM ----------

XLS files can have more than one spreadsheet per file.

f1 is a flat file.
"2 tabs" means 2 worksheets of an excel workbook.