Forum Discussion
Department_of_T
12 years agoContributor
Thankyou very much for your help. The file path is correct and the sheet exists in the workbook but the script will not run. I get this error if i try to print out the sheet name.
grooxy.lang.MissingPropertyException: No such property : thesheet for class :Script6. Error at line 12
If i comment out line 12 , then i get this error
java.lang.NullPointerException: Cannot invoke method addProperty() on null object error at line:20
If this is an easy fix then do you have any ideas? If not, then dont spent anymore time on it... i can add them manually.
Thankyou.
grooxy.lang.MissingPropertyException: No such property : thesheet for class :Script6. Error at line 12
If i comment out line 12 , then i get this error
java.lang.NullPointerException: Cannot invoke method addProperty() on null object error at line:20
import org.codehaus.groovy.scriptom.*
def source = testRunner.testCase.getTestStepByName("Datasource")
def file = new File("O:\\Technology & Telecommunications\\Application Development\\Applications Integration & Implementation\\Testing Team\\Projects\\Australia Post\\7.5 New Temp Permit - Decision Tree.xls").canonicalPath
def xls = new ActiveXObject('Excel.Application')
def sheet = new ActiveXObject("Excel.Sheet")
def workbooks = xls.Workbooks
def workbook = workbooks.Open(file)
sheet = workbook.Sheets.Item["CreateOrg"]
//log.info thesheet.Name
String FirstColumn = "B"
String LastColumn = "S"
String thiscolumn //or def if you dont want it cast yet
for(i=(int)FirstColumn;i<((int)LastColumn)+1;i++){
thiscolumn = i as char
log.info sheet.Range(thiscolumn + "34").Value
source.addProperty(sheet.Range(thiscolumn + "34").Value)
}
workbook.close(false, null, false)
xls.Quit()
Scriptom.releaseApartment()
If this is an easy fix then do you have any ideas? If not, then dont spent anymore time on it... i can add them manually.
Thankyou.