diff --git a/sheet.go b/sheet.go index 45b724f..e88f953 100644 --- a/sheet.go +++ b/sheet.go @@ -376,7 +376,7 @@ func (f *File) GetSheetName(index int) (name string) { // integer type value -1. func (f *File) getSheetID(name string) int { for sheetID, sheet := range f.GetSheetMap() { - if sheet == trimSheetName(name) { + if strings.EqualFold(sheet, trimSheetName(name)) { return sheetID } } diff --git a/sheet_test.go b/sheet_test.go index 3ad0e75..c68ad31 100644 --- a/sheet_test.go +++ b/sheet_test.go @@ -465,6 +465,13 @@ func TestDeleteAndAdjustDefinedNames(t *testing.T) { deleteAndAdjustDefinedNames(&xlsxWorkbook{}, 0) } +func TestGetSheetID(t *testing.T) { + file := NewFile() + file.NewSheet("Sheet1") + id := file.getSheetID("sheet1") + assert.NotEqual(t, -1, id) +} + func BenchmarkNewSheet(b *testing.B) { b.RunParallel(func(pb *testing.PB) { for pb.Next() {