xls icon indicating copy to clipboard operation
xls copied to clipboard

多个sheet栏位解析错误

Open AncestorDragon opened this issue 1 year ago • 1 comments

.xls文件存在多个sheet栏位

例如想解析sheet2栏位 if xlFile, err := xls.Open(filePath, "utf-8"); err == nil { //第一个sheet sheet := xlFile.GetSheet(1) fmt.Println(sheet.Name) fmt.Println(sheet.MaxRow) }

打印: Sheet2 6 这看起来没什么问题,然而只是多加了一句代码输出行数据时,整个sheet获取就会错乱

if xlFile, err := xls.Open(filePath, "utf-8"); err == nil { //第一个sheet sheet := xlFile.GetSheet(1) fmt.Println(sheet.Name) fmt.Println(sheet.MaxRow) row := sheet.Row(0) fmt.Println(row) } 打印: Sheet1 13730 &{0xc0093f4000 0xc0089d4630 map[0:0xc0089d4ae0 1:0xc0089ded80]}

AncestorDragon avatar May 09 '24 02:05 AncestorDragon

Same question when try to split each sheet into single file. It always read un-expected data into the new file from other sheets, pretty weired. I just use python xlrd/xlwt instead.

itsgodzilla avatar Jun 11 '25 08:06 itsgodzilla