Showing results for 
Search instead for 
Do you mean 
Reply
Solved! Go to solution

Write different tables into an Excel file

[ Edited ]

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

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

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

Anyone else knows something about my problem?

Solution
Solution
Accepted by topic author Alessio
‎10-20-2016 11:09 AM

Re: Write different tables into an Excel file

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

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

Re: Write different tables into an Excel file

Yeah, now it works perfectly.

Thank you very much