diff --git a/rows.go b/rows.go index 9ef52cadd44..ac9152baa25 100644 --- a/rows.go +++ b/rows.go @@ -183,6 +183,8 @@ func (rows *Rows) Columns(opts ...Options) ([]string, error) { case xml.EndElement: if xmlElement.Name.Local == "sheetData" { return rowIterator.columns, rowIterator.err + } else if xmlElement.Name.Local == "row" { + return rowIterator.columns, rowIterator.err } } } diff --git a/rows_test.go b/rows_test.go index ec25bd938a0..db1d714fad5 100644 --- a/rows_test.go +++ b/rows_test.go @@ -108,12 +108,15 @@ func TestRowsGetRowOpts(t *testing.T) { require.NoError(t, err) rows.Next() + rows.Columns() got := rows.GetRowOpts() assert.Equal(t, expectedRowStyleID1, got) rows.Next() + rows.Columns() got = rows.GetRowOpts() assert.Equal(t, expectedRowStyleID2, got) rows.Next() + rows.Columns() got = rows.GetRowOpts() assert.Equal(t, expectedRowStyleID3, got) }