Access Excel file error

questions about GAMS' tools
Post Reply
Posts: 12
Joined: 1 year ago

Access Excel file error

Post by bigakrim » 9 months ago

Hi everyone
I have a gams code working perfectly, so I want to report the results in excel using report1, report2, and report. Report1 is perfectly reported in the first sheet name classic1 of the excel spreadsheet but when gams tries to export report2 and report3 to the sheet2 (classic2) and sheet3 (classic3) an error occurs shown has followed.

Adding new sheet: classic2/classic3
*****unable to save Xls file: cannot access 'resultst.xlsx'
any changes made to the spreadsheet were not saved

the gams code for the reports export to excel is the following:

execute "xlstalk -S resultst.xlsx"
execute_unload "resultst.gdx" report1,report2, report3
execute 'gdxxrw.exe resultst.gdx O=resultst.xlsx SQ=N Par=report1 rng=classic1!'
execute 'gdxxrw.exe resultst.gdx O=resultst.xlsx SQ=N Par=report2 rng=classic2!'
execute 'gdxxrw.exe resultst.gdx O=resultst.xlsx SQ=N Par=report3 rng=classic3!'

I am using excel 2016
thanks to help me.

User avatar
Posts: 645
Joined: 5 years ago

Re: Access Excel file error

Post by bussieck » 2 months ago

This happens when a) Excel has the file open (this can be a crashed Excel) so if the problem disappears after a reboot check the next time for abbandoned Excel processes in your task manager or b) you have not activated MS Office/Excel (see ... vateoffice).

Hope this helps,

Last bumped by bigakrim 2 months ago.

Post Reply