Solved
Forum Discussion
hkim5
Staff
6 years agohey, i took your code and then ran it, it seems to work on my end when i run the testexcel() function.
from os import sys
sys.path.insert(0, 'C:\\Users\\justin.kim\\AppData\\Local\\Programs\\Python\\Python36\\Lib\\site-packages')
import openpyxl
def ExcelReadSingleCell(Sheet,Cell):
excelPath = "C:\\Users\\justin.kim\\Desktop\\test.xlsx"
wb = openpyxl.load_workbook(excelPath )
ws = wb.get_sheet_by_name(Sheet)
mycell=ws[Cell]
return str(mycell.value)
def testExcel():
Log.Message(ExcelReadSingleCell("Sheet1", "D3"))
Log.Message(ExcelReadSingleCell("Sheet1", "D4"))
Log.Message(ExcelReadSingleCell("Sheet1", "D5"))
Log.Message(ExcelReadSingleCell("Sheet1", "C3"))
Log.Message(ExcelReadSingleCell("Sheet1", "C5"))
I'd suggest filing for a support ticket, and the support engineers will guide you through using probably the report generator utility to take a look at your system and see if they can identify what the problem is with TestComplete when you are running your system. With that said, I have personally experience some problems too when using external libraries, like random closing of testcomplete. So to achieve this goal right now, I'd suggest looking into using the Sys.OleObject["Excel.Application"] object to interact with your spreadsheets.