This post shows you one of the possible ways to resolve the error when you are running SQL Agent job and you keep getting the error “System.Runtime.InteropServices.COMException: Microsoft Excel cannot access the file”.
The complete message is the one below.
Executed as user: xxx.COM.MY\admin. Unhandled Exception: System.Runtime.InteropServices.COMException: Microsoft Excel cannot access the file ‘C:\temp\QC\input\QC_BookingData.xlsx’. There are several possible reasons: The file name or path does not exist. The file is being used by another program. The workbook you are trying to save has the same name as a currently open workbook. at Microsoft.Office.Interop.Excel.Workbooks.Open(String Filename, Object UpdateLinks, Object ReadOnly, Object Format, Object Password, Object WriteResPassword, Object IgnoreReadOnlyRecommended, Object Origin, Object Delimiter, Object Editable, Object Notify, Object Converter, Object AddToMru, Object Local, Object CorruptLoad) at ConAppExcelDelimiter.ReadExcelFile.ReadExcel(String strFileName, Int32 RowCount, Int32 ColCount, String strDelimiter, Int32 intSheet) at ConAppExcelDelimiter.Program.Main(String args). Process Exit Code 255. The step failed.
What you need to do is to create a folder at