anumolu9999
9 years agoContributor
my script is asking to open the excel file
Below is the function to get data from excel. But getting error while running if the file is closed. Do this need to add any line in the script to open excel in the background. Can any one help me out with this problem. function getControlData(index) { ctrlData = ODT.Classes.NewArray(); DatafileName="MCT_ControlsNtestData.xlsx"; sCurPath = Sys.OleObject("Scripting.FileSystemObject").GetAbsolutePathName("."); excelPath = sCurPath + "\\Data\\" + DatafileName; //Get files to upload from Excel Sheet DDT.ExcelDriver(excelPath,"WSI_Controls"); while(!DDT.CurrentDriver.EOF()) { colCount=DDT.CurrentDriver.ColumnCount for(var j=0;j<=colCount-1;j++) { if(DDT.CurrentDriver.Value("index")==index) ctrlData.AddItem(DDT.CurrentDriver.Value(j)); else break; } DDT.CurrentDriver.Next(); } DDT.CloseDriver(DDT.CurrentDriver.Name); return ctrlData; }