Excel file format error

Hi Guys,

I have an application from which I am downloading excel file ->save in a sharepath -> read the excel into datatable -> write it in new excel -> perform few other operations in a loop. And this repeats until loop ends.

My issue here is, for first few times all these points execute successfully, but throws error in between with below error.

Since I ve put try catch, the error gets handled for once instance and moves on to next instance in the loop. Please let me know how to handle such errors.


did you find out the root-cause?

Hi @Devi_Raji - Were you able to open up such error file manually?


Hi @Devi_Raji

Excel file created on older verision of Office (before 2003) it will save file as .XLS not as .XLSX. And if you try to open it with 2007 or next version office then it will give this error… You can try with Repair option.

Can you share that file coz i have automated .xls files using Excel Application but havent face this issue


yes. I get that error when I open the particular file manually. But when I download the file again from web application and open it, I don’t see the error.

I suppose the file is not being downloaded completely here. no idea how to figure that out. Before saving the file from web application I am giving a delay of 3 seconds for the file to download completely.

yeah check this option though. All our servers have 2003 excel version

sorry. cant share. security issues.

Hi @Devi_Raji,

I had a Similar issue - Below is How i Had Fixed it .

1.Once the File is Downloaded from the Sharepoint and saved.
2. Kill the Excel.
3. try to Open the File - Not by Excel application scope but by - Ui Automation.
::: If Open Successful - Continue
::: Else - Re Download the File or Handle Exception

Below is what i Mean.


1 Like

Hi @Devi_Raji - When you download the file from Sharepoint, will that give any sort of alerts Download Success or Open kind of message. If yes, then you can set that as a flag and proceed with your next steps.


Thanks Anand. There is no such kind of alert, if at all it was there are no issues at all.

Thanks Mukesh. This did the job.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.