Forum Discussion

Desktopapptesti's avatar
Desktopapptesti
Occasional Contributor
4 years ago
Solved

reading data from Excel

Marsha_R 

Used below code to read the data from excel file and I am getting file not found error msg.

 

def ExcelExample():

# Get the sheet of the Excel file
excelFile = Excel.Open("C:\\temp\\DataStorageExcel.xlsx")
excelSheet = excelFile.SheetByTitle["Sheet1"]

# Read data from the Excel file
valueA = excelSheet.Cell["A", 3].Value
valueB = excelSheet.Cell[2, 3].Value
valueC = excelSheet.CellByName["C3"].Value

# Write the obtained data into a new row of the file
rowIndex = excelSheet.RowCount + 1
excelSheet.Cell["A", rowIndex].Value = valueA
excelSheet.Cell[2, rowIndex].Value = valueB
excelSheet.Cell("C", rowIndex).Value = valueC

# Save the file to apply the changes
excelFile.Save()

# Save the file with another name
# excelFile.SaveAs("C:\\temp\\DataStorageExcel_new.xlsx")


  • Hi Laxman,


     


    There are several spaces at the beginning of each item name - it looks like the developers made the hierarchy in the combo box by using this approach. 


    To make TestComplete work correctly, add the * wildcard to the item name:




    form.selectForum.ClickItem("*AutomatedQA / SmartBear TestComplete");