Cancel
Showing results for 
Search instead for 
Did you mean: 

Reading values from excel by simtalk

Pioneer
Pioneer

Hello Everyone,

 

I am learning how to impoart values to PS from an excel file using simtalk.

It would be very helpful if you could share with me a sample method or a model.

 

Thanks & Regards,

Abhirath

17 REPLIES

Re: Reading values from excel by simtalk

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

You can import excel files directly into a tableFile in Plant Simulation (Tab File - Import). You don't need SimTalk for this.

 

For program it: see <tableFile>.readExcelFile.

 

 

 

 

Steffen Bangsow
freelance simulation specialist  
web: www.bangsow.eu
mail: steffen@bangsow.net

Re: Reading values from excel by simtalk

Pioneer
Pioneer

Thanks Steffen

Re: Reading values from excel by simtalk

Creator
Creator

Hello Steffen,

I have been to work in a model and I use excel (to import) to read the database but this process is very slow, so Can you say me if I can use another software (like SLQ) or method to solve this problem or I just can use excel to export database?...

Thanks for you help!

Regards

Re: Reading values from excel by simtalk

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

There are several ways to import data. It depends on the number of data sets, you want to import.

You can use database-programs to import data. Plant Simulation offers a ODBC-interface. This you can use to send SQL statements to the database to read contents into tableFiles.

 

Or you export the data first from your data source to XML and read the XML-file in Plant Simulation.

 

But it is difficult to say, what variant is faster.

Excel needs to load all data into the memory. If you have a big data-set, you may run out of RAM capacity. The result is a very slow process (check it). In this case you need only more RAM to accelerate it.

 

So first how many data sets you need to import?

Steffen Bangsow
freelance simulation specialist  
web: www.bangsow.eu
mail: steffen@bangsow.net

Re: Reading values from excel by simtalk

Creator
Creator

Hello Steffen,

 

Thank you for you prompt answer, well I have to import from Excel 5 files but 2 of those have like 23 or more sheets.

 

So how can I do more quickly this process?

 

BTW I never have been used the ODBC-interface, can you explain me this process? or How can I make this?

 

Regards.

Re: Reading values from excel by simtalk

Creator
Creator

Steffen,

 

BTW I forgot to mention that I have to read this sheets at beginning.

 

Regards.

Re: Reading values from excel by simtalk

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

do you need to re-load all data or can you "store" some data in the model?

 

 

Steffen Bangsow
freelance simulation specialist  
web: www.bangsow.eu
mail: steffen@bangsow.net

Re: Reading values from excel by simtalk

Creator
Creator

Hello Steffen,

 

Sorry for not to answer before, but the email was in spam hehe..

 

Well, I need read all the data at beginning only the first time, but if it has any change I have to re-load again.

 

 

Re: Reading values from excel by simtalk

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor
then it is the best to load the data into your model (e.g. method + button) and safe it (the filled tables) with your model.
The runtime for loading the data then you have only once.
Steffen Bangsow
freelance simulation specialist  
web: www.bangsow.eu
mail: steffen@bangsow.net