cancel
Showing results for 
Search instead for 
Did you mean: 

Write different tables into an Excel file

Legend
Legend

Hello,

I have different tables in my model which I want to export in an excel file.
Using writeExcel I can create one file for each table.

I'd like to create only one file with several sheets containing each one a table. But if I try to save another table into the same file, it will be overwritten.

Do you know if is possible to do what I need?

Regards
Alessio

6 REPLIES

Re: Write different tables into an Excel file

Siemens Phenom Siemens Phenom
Siemens Phenom

Hello Alessio,

When I use the following code I get an Excel file with two sheets:

TableFile.writeExcelFile("D:\test.xlsx", "Sheet1")
TableFile.writeExcelFile("D:\test.xlsx", "Sheet2")
Regards,

Ralf

Re: Write different tables into an Excel file

Legend
Legend

Thanks for your reply.

 

I tried, but it doesn't create two sheets.
I attach an example for your reference.

Re: Write different tables into an Excel file

Legend
Legend

Anyone else knows something about my problem?

Re: Write different tables into an Excel file

Siemens Phenom Siemens Phenom
Siemens Phenom

Hi Alessio,

If you specify the file format as .xlsx it works for me:

is
do
	Table1.WriteExcelFile("D:\users\f00706b\Desktop\Prova.xlsx","foglio1",true);
	Table1.WriteExcelFile("D:\users\f00706b\Desktop\Prova.xlsx","foglio2",true);
end;

If you don't specify the format Excel uses the old .xls format and saves just one sheet.

 

Regards,

Ralf

Re: Write different tables into an Excel file

Legend
Legend

I wasn't aware about this difference.
I will try in this way.

Re: Write different tables into an Excel file

Legend
Legend

Yeah, now it works perfectly.

Thank you very much