-1

I've been trying to open an EXCEL file through console but everytime I get the following exception:

System.Runtime.InteropServices.COMException

that the file doesn't exist or missing.Path is correct. Here is the code I get the exception:

string path = @"C:\User\Desktop\TerritoryFile.xlsx";
var file = new Excel.Application();
file.Visible = false;
var wb = file.Workbooks.Open(path);

Could it be something else apart from a wrong path

i_ll_be_back
  • 317
  • 1
  • 14

1 Answers1

0

try this instead

string path = @"your file path ";
var file = new Microsoft.Office.Interop.Excel.Application();
file.Visible = false;
var wb = file.Workbooks.Open(path);
Simon Price
  • 3,011
  • 3
  • 34
  • 98