Skip to content

Commit

Permalink
This closes qax-os#1874, reduces memory usage for the GetRows function (
Browse files Browse the repository at this point in the history
qax-os#1875)

- Avoid allocate memory for reading continuously empty rows on the tail of the worksheet
  • Loading branch information
iraj720 committed Apr 11, 2024
1 parent 5f8a5b8 commit 3e636ae
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion rows.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,11 @@ func (f *File) GetRows(sheet string, opts ...Options) ([][]string, error) {
if err != nil {
break
}
results = append(results, row)
if len(row) > 0 {
if emptyRows := cur - maxVal - 1; emptyRows > 0 {
results = append(results, make([][]string, emptyRows)...)
}
results = append(results, row)
maxVal = cur
}
}
Expand Down

0 comments on commit 3e636ae

Please sign in to comment.