我嘗試下面的代碼,但我得到一個錯誤錯誤讀取Excel文件在golang
「單值上下文多值cell.String()」
代碼
package main
import (
"fmt"
"github.com/tealeg/xlsx"
)
func main() {
excelFileName := "test.xlsx"
xlFile, err := xlsx.OpenFile(excelFileName)
if err != nil {
}
for _, sheet := range xlFile.Sheets {
for _, row := range sheet.Rows {
for _, cell := range row.Cells {
fmt.Printf("%s ", cell.String(), "123")
}
fmt.Printf("\n")
}
}
}
}
了it..reallly有幫助謝謝 –