Hi guys,
I’m probably just shouting in the wind here given I am using a 3rd party library (See: GitHub - ExcelDataReader/ExcelDataReader: Lightweight and fast library written in C# for reading Microsoft Excel files). I started using this library as the mono implementation of reading excel file is broken for the 64bit version.
I have the ExcelDataReader functionality working in the Unity editor. I read an Excel file and store the data in memory. No problem.
I then build my game. I put the excel file into the _Data location. I run the game and now the Excel file is not being read.
Debugging using LogError shows the FileStream has been opened. There is no problem in opening the Excel file. It is in the correct location.
The problem is when I use the stream to CreateOpenXmlReader(). The excelReader.IsClosed is equal to True.
I don’t understand why this is the case. The DLL’s for the library are in the Managed Folder the Excel files are in the correct location.
Basically I’m asking anyone who has used ExcelDataReader and created a project build, is it solvable and how so? Thanks.
protected void OpenDataReader(string _filename) {
DataSet result;
_filename = string.Concat(Application.dataPath, "/Data/", _filename, ".xlsx");
FileStream stream = File.Open(_filename, FileMode.Open, FileAccess.Read);
**excelReader = ExcelReaderFactory.CreateOpenXmlReader(stream);** //IsClosed = True
result = excelReader.AsDataSet();
skipFirstRow = true;
}