0

I am trying to export a table from AnyLogic's database to an excel file in a parameters variation using this code:

Database myFile = new Database(this, "A DB from Excel", "DataBaseExport.xlsx");
ModelDatabase modelDB = getEngine().getModelDatabase();
modelDB.exportToExternalDB("flowchart_stats_time_in_state_log", myFile.getConnection(), "Sheet 1", true, true);

I am then given this error enter image description here

With this after

enter image description here

2 Answers 2

1

It turns out that the name of the excel sheet "sheet1" is the culprit. Upon removing the "1" and creating matching column names in the excel file, the data is able to be exported.

Sign up to request clarification or add additional context in comments.

Comments

0

Not sure about your issue, but maybe try this instead:

  1. create a database object as below: enter image description here

  2. Call this code at runtime: enter image description here

1 Comment

Unfortunately PLE does not allow Database. But, the problem has been solved.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.