From 7080d929155a21391028c3b6e6d94e734d9da4d9 Mon Sep 17 00:00:00 2001 From: Nima Date: Thu, 11 Apr 2024 11:50:34 +0330 Subject: [PATCH 1/3] just adding not empty rows Signed-off-by: Nima --- rows.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rows.go b/rows.go index 7610836f17..af9145590d 100644 --- a/rows.go +++ b/rows.go @@ -70,8 +70,8 @@ func (f *File) GetRows(sheet string, opts ...Options) ([][]string, error) { if err != nil { break } - results = append(results, row) if len(row) > 0 { + results = append(results, row) maxVal = cur } } From f654029b7eda57376db2b984629975f4abdfa96d Mon Sep 17 00:00:00 2001 From: Nima Date: Thu, 11 Apr 2024 12:59:59 +0330 Subject: [PATCH 2/3] fix null cells Signed-off-by: Nima --- rows.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/rows.go b/rows.go index af9145590d..80675cdf5e 100644 --- a/rows.go +++ b/rows.go @@ -70,7 +70,11 @@ func (f *File) GetRows(sheet string, opts ...Options) ([][]string, error) { if err != nil { break } - if len(row) > 0 { + if len(row) > 0 { + nullCells := cur - maxVal + for i := 0; i < nullCells - 1; i++ { + results = append(results, []string(nil)) + } results = append(results, row) maxVal = cur } From e098c3a1630445c0fa3bf06d6079c943e6a75055 Mon Sep 17 00:00:00 2001 From: Nima Date: Thu, 11 Apr 2024 17:43:09 +0330 Subject: [PATCH 3/3] simplifying code Signed-off-by: Nima --- rows.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/rows.go b/rows.go index 80675cdf5e..bf22d0cf03 100644 --- a/rows.go +++ b/rows.go @@ -70,10 +70,9 @@ func (f *File) GetRows(sheet string, opts ...Options) ([][]string, error) { if err != nil { break } - if len(row) > 0 { - nullCells := cur - maxVal - for i := 0; i < nullCells - 1; i++ { - results = append(results, []string(nil)) + if len(row) > 0 { + if emptyRows := cur - maxVal - 1; emptyRows > 0 { + results = append(results, make([][]string, emptyRows)...) } results = append(results, row) maxVal = cur