Skip to content

Commit 3e636ae

Browse files
authored
This closes #1874, reduces memory usage for the GetRows function (#1875)
- Avoid allocate memory for reading continuously empty rows on the tail of the worksheet
1 parent 5f8a5b8 commit 3e636ae

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

rows.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,11 @@ func (f *File) GetRows(sheet string, opts ...Options) ([][]string, error) {
7070
if err != nil {
7171
break
7272
}
73-
results = append(results, row)
7473
if len(row) > 0 {
74+
if emptyRows := cur - maxVal - 1; emptyRows > 0 {
75+
results = append(results, make([][]string, emptyRows)...)
76+
}
77+
results = append(results, row)
7578
maxVal = cur
7679
}
7780
}

0 commit comments

Comments
 (0)