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.
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.
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.
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
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.