2019/9/3
今天開始學習使用golang操作excel,
1, 安裝git并配置好環境變數
2, go get github.com/Luxurioust/excelize 成功下載到src目錄下

3, 網路上找了一段代碼測驗,出現錯誤
undefined: excelize.CreateFile go-vet
Peek Problem
No quick fixes available
如圖:

原始碼如下:
package main
import (
"fmt"
"os"
"github.com/Luxurioust/excelize"
)
func main() {
xlsx := excelize.CreateFile()
// Create a new sheet.
xlsx.NewSheet(2, "Sheet2")
// Set value of a cell.
xlsx.SetCellValue("Sheet2", "A2", "Hello world.")
xlsx.SetCellValue("Sheet1", "B2", 100)
// Set active sheet of the workbook.
xlsx.SetActiveSheet(2)
// Save xlsx file by the given path.
err := xlsx.WriteTo("/tmp/Workbook.xlsx")
if err != nil {
fmt.Println(err)
os.Exit(1)
}
}
uj5u.com熱心網友回復:
https://github.com/360EntSecGroup-Skylar/excelize根據這里去修改下就可以了。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/155748.html
標籤:go語言
上一篇:win10 64位電腦上打包的python程式,無法在win7 32位電腦上運行,有什么好的解決辦法嗎?
下一篇:import timetime = time.gmtime()print(time.strftime("%Y-%m-%d %H:%M:%S",time))
