I see the code like this,
function environmentVar()
{
envVar = aqEnvironmentVariable.GetEnvironmentVariable("USERPROFILE");
envVarfolder = envVar + "\\DMData\\";
if (!aqFileSystem.Exists(envVarfolder))
aqFileSystem.CreateFolder(envVarfolder);
else
Log.Message("Folder Exists");
if (!aqFileSystem.Exists(envVarfolder + "\\DMMobile"))
{
Log.Error("Excel file doesn't exists");
Runner.Stop();
}
}
function getExcelData(filename)
{
var excelFile = Excel.Open(envVarfolder + "\\DMMobile.xlsx");
var excelSheet = excelFile.SheetByTitle(fileName);
return excelSheet;
}
You create a folder called DMData in %userprofile%, if it does not exist. You then check if the folder DMMobile does not exist, and output "Excel file doesn't exists" - are you checking the folder or file?
Then you get the Excel file DDMobile.xlsx from folder %userprofile%\DMData - which will not exist, if you've created the folder.
I don't really understand what's going on. Why can't you just read the Excel file as normal!?