diff --git a/options.go b/options.go index 27dd2e9..6496642 100644 --- a/options.go +++ b/options.go @@ -60,3 +60,14 @@ type Options struct { // Column names list columnNames []string } + +func (o *Options) fieldCount() int { + fCount := 0 + for i := range o.fieldsTypes { + if o.fieldsTypes[i] != ' ' { + fCount++ + } + } + + return fCount +} diff --git a/readerxlsx.go b/readerxlsx.go index 4b094ba..9d42097 100644 --- a/readerxlsx.go +++ b/readerxlsx.go @@ -109,6 +109,8 @@ func (r *XlsxReader) GetRow(asStrings bool) ([]any, error) { args = append(args, parsedValue) } + args = append(args, make([]any, r.options.fieldCount()-len(args))...) + return args, nil } diff --git a/readerxlsx_test.go b/readerxlsx_test.go index 3bb56c6..ca3249e 100644 --- a/readerxlsx_test.go +++ b/readerxlsx_test.go @@ -29,6 +29,10 @@ func TestXlsxReaderBasic(t *testing.T) { assert.Equal(t, []any{"7710146208", nil, nil, "99386901", "99386901", "304722813269", "TSENTRALNYY TELEGRAF", "780000334079", "780000334079", "10432641", t1, t2, 50.00, 0.80, 49.20, "553691******1214", "026094", "D", "MC OTHER"}, row) row, err = xlsxReader.GetRow(false) + assert.NoError(t, err) + assert.Len(t, row, 19) + + _, err = xlsxReader.GetRow(false) assert.Equal(t, io.EOF, err) err = xlsxReader.Close() diff --git a/testdata/xlsx/38_049RMZ_all.xlsx b/testdata/xlsx/38_049RMZ_all.xlsx index bae2e0f..96d91bd 100644 Binary files a/testdata/xlsx/38_049RMZ_all.xlsx and b/testdata/xlsx/38_049RMZ_all.xlsx differ