Reputation:
I use the following code to parse an XLSX
file.
private IExcelDataReader GetExcelDataReaderForFile(string filePath)
{
FileStream stream = File.Open(filePath, FileMode.Open, FileAccess.Read);
// Create the excel data reader
IExcelDataReader excelReader;
excelReader = ExcelReaderFactory.CreateOpenXmlReader(stream);
// Close the stream
stream.Close();
// First row are columns names
excelReader.IsFirstRowAsColumnNames = true;
return excelReader;
}
Im running this code on my android. The path is subjective to Application.persistentDataPath
. The problem here is that Im getting the following strange error,
Access to the path "/tmp" is denied.
How do I sort it out? or is there any other ways to parse xlsx files in Android?
Upvotes: 1
Views: 1393
Reputation: 2676
You are requesting a file/directory at the root of the drive.
You should use ./tmp
(notice the .) or if you insist Application.persistentDataPath + "/tmp"
Upvotes: 1