Reputation: 53
I am using the MVC project. My requirement is uploading an excel file and parse the file. The project is hosted in Azure. So excel file is uploaded in the separate network path. after that uploaded file need to be parsed. I used oledb connection(don't know any other method is there). Here I gave that network path and its credential in the connection string. but it throws the exception. Code for Parsing excel is attached.
Upvotes: 0
Views: 96
Reputation: 27793
As far as I know, using OLEDB Data Provider Connection to read and parse excel file is not supported in Azure web app. We can find this feedback for supporting OLEDB drivers in Azure web app. If you want your code using OLEDB Data Provider Connection can works on Azure, you can try other hosting options, such as Azure Virtual Machine or Cloud Service.
Besides, you can try to use other libraries which is supported in Azure web app to read Excel files, such as ExcelDataReader, and the following code works for me on Azure web app.
FileStream stream = System.IO.File.Open(filepath, FileMode.Open, FileAccess.Read);
IExcelDataReader excelReader = ExcelReaderFactory.CreateOpenXmlReader(stream);
DataSet result = excelReader.AsDataSet();
Upvotes: 1