Skip to content
This repository was archived by the owner on Aug 13, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib.go
Original file line number Diff line number Diff line change
Expand Up @@ -863,6 +863,7 @@ func readSheetsFromZipFile(f *zip.File, file *File, sheetXMLMap map[string]strin
sb.WriteString(strconv.Itoa(sheet.Index))
sb.WriteString("} ")
sb.WriteString(sheet.Error.Error())
continue
}
sheetName := sheet.Sheet.Name
sheetsByName[sheetName] = sheet.Sheet
Expand Down
7 changes: 7 additions & 0 deletions lib_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1364,6 +1364,13 @@ func TestLib(t *testing.T) {
}
})

// Attempting to open a file with an invalid sheet name.
csRunO(c, "ReadFileWithInvalidSheet", func(c *qt.C, option FileOption) {
_, err := OpenFile("./testdocs/sheet_name_length_above_max.xlsx", option)
c.Assert(err, qt.Not(qt.IsNil))
c.Assert(err.Error(), qt.Equals, "OpenFile: ReadZip: ReadZipReader: {SheetIndex: 0} readSheetFromFile: sheet name is invalid: sheet name must be 31 or fewer characters long. It is currently '32' characters long")
})

}

func TestReadRowsFromSheet(t *testing.T) {
Expand Down
Binary file added testdocs/sheet_name_length_above_max.xlsx
Binary file not shown.