rraghvanithe below code is the generic function created for access the excel files.
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.xlsx"))
{
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
}
Here in function getExcelData variable excelFile is getting null so the error shows as sheetByTitle of null.
The customer requirement is they need to access the excel from environment variable so that might be easy to copy the excel folders over there and execute the script.
As I mentioned previously the same script in other workstation working fine. They also access from the environment variable only.
If because this code am getting error means let me know