From 3e636ae7b20285d4efb3d21bba0e1c165318f9f8 Mon Sep 17 00:00:00 2001 From: Nima <52995288+iraj720@users.noreply.github.com> Date: Thu, 11 Apr 2024 18:42:56 +0330 Subject: [PATCH] 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 --- rows.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rows.go b/rows.go index 7610836..bf22d0c 100644 --- a/rows.go +++ b/rows.go @@ -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 } }