List Icon
Mailing list Archive

2019 up to July 2022 | 20182017  |  2016  2015 2014 | 2013

The mailing list has been closed since July 2022, but continues to serve as an archive of information about QF-Test.
If you want to stay informed about news about QF-Test, you can simply subscribe to our newsletter:
Subscribe to Newsletter  

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [QF-Test] Help required working Excel reports in QF-Test version 3.5.5-p1 -- >Jython scripting

  • Subject: Re: [QF-Test] Help required working Excel reports in QF-Test version 3.5.5-p1 -- >Jython scripting
  • From: "Robert Lahmer, QFS support" <support@?.de>
  • Date: Tue, 28 Jul 2015 14:36:15 +0200

Hello Hema,

here's an example code based on the more modern Apache POI (which - in
contrast to the JXL library - is also able to deal with .xlsx files):

from org.apache.poi.hssf.usermodel import HSSFWorkbook
from import FileInputStream

filename = rc.lookup("qftest", "suite.dir") + "/mytable.xls"
fis = FileInputStream(filename)
workbook = HSSFWorkbook(fis)
sheet = workbook.getSheet("Deal Audit");
TValue = 0
col = ord("R") - ord("A")
for row in range(9, 20 + 1):
    cell = sheet.getRow(row - 1).getCell(col)
    TValue += cell.getNumericCellValue()
print TValue

Best regards,

Am 27.07.2015 15:56, schrieb Hema Nagaraj:

Please help me in writing Jython script to find SUM of range of cells in

Where testfile is the File name , here I have given dummy path, “Deal
Audit” is the sheet name.

I have worked earlier on excel for verifying cell data, but finding
difficulty in this scenario.

*Scenario: Trying to add a range of rows ranging from R9 to R20 in excel
and store Total in Variable “TValue”*

Below is the script :

from jxl import *

from import File

testFile = "<Path><xls file>"

workbook = Workbook.getWorkbook(File(testFile))

sheet = workbook.getSheet("Deal Audit")

Rvalue = sheet.range(R9:R20)

rc.logMessage(str(RValue), dontcompactify=True, report=True, nowrap=False)

TValue = workbook.worksheetfunction.sum(Rvalue)

rc.logMessage(str(TValue), dontcompactify=True, report=True, nowrap=False)



qftest-list mailing list