【发布时间】:2021-05-20 12:36:06
【问题描述】:
我正在尝试通过 Google Docs API 将文本添加到现有的 Google Docs 文件中,为此我正在使用 Golang。我按照https://developers.google.com/docs/api/quickstart/go 中的步骤操作,但我不知道如何编辑此文件?
我发现如何在文件中添加文本是我的代码的相关部分:
b := &docs.BatchUpdateDocumentRequest{
Requests: []*docs.Request{
{
InsertText: &docs.InsertTextRequest{
Text: "texttoadd",
Location: &docs.Location{
Index: md.Body.Content[len(md.Body.Content)-1].EndIndex - 1,
},
},
},
},
}
_, err = srv.Documents.BatchUpdate("your_document_id", b).Do()
if err != nil {
fmt.Println(err)
}
【问题讨论】:
-
请问
but I don't know how can I edit this file和I still couldn't solve the problem的详细情况?如果出现错误,请出示。
标签: go google-docs google-docs-api