Access Excel file error

questions about GAMS' tools
Post Reply
bigakrim
User
User
Posts: 7
Joined: 10 months ago

Access Excel file error

Post by bigakrim » 2 weeks 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
bussieck
Moderator
Moderator
Posts: 534
Joined: 4 years ago

Re: Access Excel file error

Post by bussieck » 2 weeks 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 https://support.microsoft.com/en-us/off ... vateoffice).

Hope this helps,
-Michae

Post Reply