03-06-2020 04:35 PM
What you are looking for is the 'mark after read chars' output of the read spreadsheet file. Couple that with a while loop with a shift register feeding the 'mark after read' as 'offset' to the next iteration and reading n rows at a time, you can quickly skip through any number of rows you want.
Shown below, I read one row, and give the length of the row as the starting offset for the next row. This process with a desired number of rows as input can give you the the offset required to skip the said n number of rows.
03-06-2020 05:24 PM
@semaphorecluster wrote:
This process with a desired number of rows as input can give you the the offset required to skip the said n number of rows.
... however, it is extremely inefficient, because with every iteration the file is opened, read, and closed again, creating a huge overhead, especially if the file is big. Your use of the term "quickly" is misleading. 😄
For any typical file size, it is much simpler to just read the entire file (or very large sections if the file is truly gigantic) at once, then parse the string in memory.
Also, shouldn't your code stop if the end of the file or the desired row is reached?