github.com/tealeg/xlsx 问题”multiple-value cell.String() in single-value context” 解决

  • Post author:
  • Post category:其他


github.com/tealeg/xlsx

读取xlsx时报错

multiple-value cell.String() in single-value context”

解决办法

for _, cell := range row.Cells {
    fmt.Printf("%s ", cell.String(), "123")
}

改为

for _, cell := range row.Cells {
    val, _ := cell.String()
    fmt.Printf("%s ", val)
}