有什么方法可以在 Go 中写入现有的 Excel 文件?,我尝试过一些库,这些库基本上是从空白创建 Excel 文件,但我需要在现有文件上写入。任何帮助表示赞赏,谢谢。更新 使用@Marc推荐的excel包,我收到了这个错误:panic: Ocurrió una excepción.goroutine 16 [running]:runtime.panic(0x4afb40, 0xc082000440) c:/go/src/pkg/runtime/panic.c:279 +0x11fgithub.com/mattn/go-ole/oleutil.MustCallMethod(0x1cf688, 0x4eb870, 0x4, 0x2e3e38, 0x3, 0x3, 0xc082007080) C:/Go/path/src/github.com/mattn/go-ole/oleutil/oleutil.go:58 +0xddgithub.com/nivrrex/excel.(*Excel).Open(0x2e3f08, 0x4f3d70, 0x9, 0x0, 0x0, 0x0) C:/Go/path/src/github.com/nivrrex/excel/excel.go:65 +0x582main.main() C:/Desarrollo/Projects/excel_writer_go/excel_writer.go:12 +0xa0goroutine 19 [finalizer wait]:runtime.park(0x414d40, 0x576c00, 0x575649) c:/go/src/pkg/runtime/proc.c:1369 +0xacruntime.parkunlock(0x576c00, 0x575649) c:/go/src/pkg/runtime/proc.c:1385 +0x42runfinq() c:/go/src/pkg/runtime/mgc0.c:2644 +0xddruntime.goexit() c:/go/src/pkg/runtime/proc.c:1445exit status 2[Finished in 4.4s with exit code 1][cmd: go build C:\Desarrollo\Projects\excel_writer_go\excel_writer.go & go run C:\Desarrollo\Projects\excel_writer_go\excel_writer.go][dir: C:\Desarrollo\Projects\excel_writer_go][path: C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Go\bin]代码 这是我尝试使用的代码。package mainimport ( "fmt" "github.com/nivrrex/excel")func main() { e := &excel.Excel{Visible: false, Readonly: false, Saved: true} filePath := "test.xlsx" e.Open(filePath) //Print fmt.Println(e.Cells(1, 1)) e.Sheet(1) e.CellsWrite("Hello", 2, 2) e.Save() e.Close()}
2 回答
- 2 回答
- 0 关注
- 405 浏览
添加回答
举报
0/150
提交
取消