While loop in combination with a blank row in Excel

Asked by Lina

I'm trying to use a while loop for copying text in an excel file. The copied text is then later used in another application.
The first column in the excel file has for example 25 rows with text and I want to read the text row by row until the first blank row appears. I want to use a while loop but can't not get it working.

 I'm not able to use find or exist in the while loop since there will always be blank rows in the excel sheet. I can use a region and just have one blank row in the region, but is there any better solution? Right now I'm using a for loop instead of a while loop.

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

Why don't you use the packages xlrd and xlwt? (faq 2208)

Navigating visually in an excel sheet is rather complex and error prone.

Nevertheless: An option in between, supposing even line heights:

- evaluate the line height
- start with top left cell
- go to next cell by adding line height to top left corner of current cell
- check cell content using an image of blank cell
- go down until you find a blank cell

This is generally the best approach for some table oriented GUIs or screen content, that has some identifiable raster behind: if you know this raster or be able to evaluate it somehow, you can go to every cell of the layout only by calculating positions/dimensions.

The new version 1.1.0 will have some support for that: you can split a region into rows and/or colums, so that the respective elements are accessible by a table index.

Can you help with this problem?

Provide an answer of your own, or ask Lina for more information if necessary.

To post a message you must log in.