【发布时间】:2021-05-11 06:33:56
【问题描述】:
我有一个 node.js 应用并使用 googleapis 的 docs_v1 创建文档
const createdDoc = await docs.create({
requestBody: { title }
});
然后在 batchUpdate 之后填充数据。
await docs.batchUpdate({
documentId: createdDoc.documentId,
requestBody: {
requests: [
{
insertText: {
location: {
index: 1
},
text: 'Some very important data in body of a document'
}
}
]
}
});
一切都很顺利,直到我收到在文档标题中添加一些链接的要求。 image with example of header 我尝试了十几种方法\请求创建分段和添加文本,但没有成功。
如果有人遇到此类问题并解决此问题 - 请分享请求的 sn-p。
【问题讨论】:
-
关于
I tried dozen of approaches\request to create segment and add text, but I didn't meet any success.,我无法理解你的目标。我为我糟糕的英语水平道歉。我可以问你目标的细节吗? -
@Tanike 谢谢你的提问。在 batchUpdate 中,我尝试在请求数组中的 requestBody 中首先使用 createHeader 命令,然后使用 createNamedRange,并在标题和正文段中插入文本。 (这在同一个有效载荷中的所有命令)
-
感谢您的回复。我不得不为我糟糕的英语水平道歉。从您的回复中,我理解您的努力。但是,不幸的是,从您的回复中,我无法理解您的目标。我可以问你目标的细节吗?
标签: node.js google-api google-docs google-docs-api