Page 1 of 1

Failed to connect to Excel to get data from __.xlsx

Posted: Tue Oct 19, 2021 10:55 pm
by egrdavie
I receive a strange error in trying to retrieve date from an Excel spreadsheet. The error messages are,
ERROR: Failed to connect to Excel to get data from ___.xlsx.
ERROR: Unable to get data values for {variable name}.
ERROR: Failed to make live links to data - aborting simulation.
ERROR: Unable to correctly load in exogenous values - aborting.

The strange thing is that the error occurs only in one model. If I create a different, very simple model and use the same GET XLS DATA call, the model imports the necessary data without any errors. The function call is,
GET XLS DATA( '?{file pointer}' , 'sheet name', 'A' , 'D2' ). (In my case, the file pointer is '?ALI Municipal'.)

Any idea why the model cannot read the data? Calls to the same spreadsheet through GET XLS CONSTANTS work fine. The sheet name in question is the first of three sheets in the file. GET XLS CONSTANTS calls refer to a different sheet in the Excel file.

I am using Vensim version DSS 9.0.0.

Re: Failed to connect to Excel to get data from __.xlsx

Posted: Wed Oct 20, 2021 6:36 am
by Administrator
We'd need to see the model/spreadsheet to be able to help. Most likely it's a typo somewhere (it usually is).

Re: Failed to connect to Excel to get data from __.xlsx

Posted: Wed Oct 20, 2021 12:57 pm
by tomfid
Using the ? operator prevents most filename typos, though I guess the cell reference could be wrong.

Another possibility is that you're using the DIRECT protocol for GET XLS (see Tools>Options>Settings) and the file is locked because it's open in Excel.

Re: Failed to connect to Excel to get data from __.xlsx

Posted: Thu Oct 21, 2021 4:18 pm
by egrdavie
There were some typos in the '?{filename}' settings, but I have corrected those. One previous error type was a space between the ? and the filename, but those errors are now corrected. There were also quite a few ? aliases, since different people have worked on the model over the past few years. Now there are only a few of those aliases.

I checked the DIRECT protocol. It's set for OLE.

Re: Failed to connect to Excel to get data from __.xlsx

Posted: Mon Oct 25, 2021 3:49 pm
by tomfid
Did these changes fix the problem, or is it still failing to read some links? I think we'd need a copy of the model for further diagnosis.

Switching to DIRECT mode is more reliable, but you can't have the spreadsheet open when the model runs (Excel is hostile about file locking).

Re: Failed to connect to Excel to get data from __.xlsx

Posted: Thu Oct 28, 2021 5:21 pm
by egrdavie
Unfortunately, the problem persists. Can you please tell me where to send the model? We'd be happy for you to take a look. We will send both the Vensim model and the Excel spreadsheet.

Re: Failed to connect to Excel to get data from __.xlsx

Posted: Thu Oct 28, 2021 6:09 pm
by tomfid
Vensim at vensim.com.