Unable to save data after writing Datatable in a .xls excel file


I’m trying to modify a “.xls” excel file by writing a datatable in a specific range.
While i’m able to manually type the data and save the excel file normally, when this is performed usign uiPath excel write range activity (the one used in excel app scope) the data gets written, but the file does not get saved.

Things I have tried :

  1. Used Write Cell Activity which works normally , however not a solution since the data is in bulk (multiple rows and columns)
  2. Write Range (workbook activity , independent of excel scope) works but locks the file editing and corrupts the file (gives an error message when opened after activity execution)
  3. Tried to save using macro (by invoking macro) but does not save the file even though no eror in macro execution occurs
  4. Have tried using Save Excel Workbook activity and Close Excel workbook activity with same results


  1. If file is visible, I can see that data is written, however the file remains open after excel application closes. it only closes once bot execution stops. If i try to close the file while bot is paused i get a save file data prompt from excel

  2. I do not see any options in saveas dropdown (only .xls)

  3. File has protected sheets which require password , however the area where i need to input data is not protected as i can manually open , edit and save the data normally

Kindly guide about any other approaches to try

Thanks !


If I good remember Excel Activities does not support .xls files. We had that problem with the SAP reports.

Workaround for that is to :
Read Range .XLS file in the Excel Application Scope
and save Workbook as variable.
Write range straight away but with .xlsx extension.
Close Workbook

Out of the Excel Application Scope
Read range of the new created .xlsx file.

I know that previously Excel Activities could work with .xls files so you can also do downgrade of the package but it is not recommended.

Hello @Maciej_Witos

Thanks for the suggestion !

However my goal is to keep information in .xls only. if i use this approach will the formatting be preserved? more importantly, will I be able to convert it back to .xls (as that’s the requirement of the tool where i would input this file)

I was not sure but I checked. I was able to create a .XLS file using Write Range (not in the Scope) and the file is working.
So, maybe if you try open the .XLS file and Read Range in the Excel Application Scope and the rest action on DataTable do out of the Scope.
On the end, try to Write Range with .XLS extension.

I ahve tried the Write Range (without the scope) it does write the data, but locks the file cells and when you open it manually it gives a pop saying data may be corrupted