Exporting and importing tables to and from Excel including column headers

Exporting and importing tables to and from Excel including column headers

jacopo_r
Not applicable
11 Views
1 Reply
Message 1 of 2

Exporting and importing tables to and from Excel including column headers

jacopo_r
Not applicable

[ FlexSim 24.0.1 ]

Hello,

I need to export and import to and from Excel using the function "excelexporttable" and I don't see any parameter to include the columns header. Is there any way for doing this?

Thanks.

0 Likes
Accepted solutions (1)
12 Views
1 Reply
Reply (1)
Message 2 of 2

jason_lightfootVL7B4
Autodesk
Autodesk
Accepted solution

Can you not use the commands excelmultitableimport() and excelmultitableexport() ?

Then you would be able to specify where the data entries start using starting row and column and just check the option for using column and row headers:

Image.png

In this case the row headers will be from column 2 and the column headers will be from row 6.

If your row headers are in column 1 make sure you enter 0 or 2 for the starting column - a value of 1 forces column one to be read as data, ignoring the checkbox for row data.

From the 24.0 documentation:

"The starting row and starting column fields determine where the Excel Importer will look on the Excel sheet for the data it needs to import. Enter the starting location for your data in these cells not the location of the headers or data distinction information. If you leave the values for these cells at 0, the Excel Importer will automatically adjust where it imports the data from. If you always leave your data at the top left of the worksheet you will never need to enter a value other than 0 in these cells regardless of whether or not you have headers or data distinction information in front of the data."


You can also consider using importtable() and exporttable() which read and write csv files and have the options to specify headers.

0 Likes