peterservice-rnd/robotframework-excellib

Get row count

Closed this issue · 2 comments

Hello!
First, I would like to thank you for creating this library, it's great to have finally a library that works with XLSX files :)
I am only missing one keyword - get row count that would enable me to loop through the rows in an excel sheet. Would it be possible to implement it?
Thank you :)

@aleskarovadi , I think that _get_sheet should not be private.
Like this:

Open Excel Document    filename=file.xlsx    doc_id=docid 
${sheet1}=   Get sheet    Sheet1 
Comment    Print first row 
Log    ${sheet1.rows}[1] 

@lucietriskova, hello!

Method get_sheet is public now, so you can loop through the rows:

Open Excel Document    filename=file.xlsx    doc_id=docid 
${sheet1}=    Get sheet    Sheet1 
:FOR     ${row}    IN    @{sheet1.values}
\    Log     ${row}

See more information in openpyxl.worksheet documentation.

These changes are now availble on PyPi (version 1.1.0 of robotframework-excellib)