我正在尝试通过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)
}
眼眸繁星
小唯快跑啊
饮歌长啸
随时随地看视频慕课网APP
相关分类