Forum Discussion
baxatob
11 years agoCommunity Hero
You can parse your table this way (I wrote the code in Python, but you should understand the idea) :
table = Project.Variables.YourTable
rows = table.RowCount
cols = table.ColumnCount
for r in range (rows):
for c in range (cols):
test_name = table.Item[c, 0]
if table.Item[c, r] == "Y":
# do something with test_name
jgoetz
11 years agoOccasional Contributor
Thank you! I did the following for VB.
Sub testSuiteRun()
Dim excelApplication, projectPath
Dim sheetName
'Open and set Excel objects, spreadsheet, sheet, row count and column count
Set excelApplication = Sys.OleObject("Excel.Application")
projectPath = Project.Path
Set book = excelApplication.Workbooks.Open(projectPath & "TestCase Runs\TC_Script_Run.xlsx")
sheetName = "Sheet 1"
Set sheet = book.Sheets(sheetName)
rowCount = sheet.UsedRange.Rows.Count
colCount = sheet.UsedRange.Columns.Count
'Loop through rows of spreadsheet ignoring the header row
For r = 2 To rowCount
'Loop through component script columns
For c = 4 To colCount
'Set test case name to the header cell (row 1) for active column and the run indicator for active column and row
testCaseName = VarToString(sheet.Cells(1, c))
runInd = VarToString(sheet.Cells(r, c))
'Check if test case name is not blank for active col to eliminate extra blank columns
If testCaseName <> "" Then
'check if run indicator is Y and if so then call that component script
If runInd = "Y" Then
Call Eval("KeywordTests." + testCaseName + ".Run")
End If
End If
Next
Next
'quit excel
excelApplication.Quit
End Sub