Google Doc 更新一个文档 替换多个变量

gapi.client.request({
        method: 'POST',
        path: `https://docs.googleapis.com/v1/documents/${docId}:batchUpdate`,
        body: {
          requests: [
            {
              replaceAllText: {
                replaceText: '蓑笠翁',
                containsText: {
                  text: '${oldMan}',
                  matchCase:true
                }
              }
            },
            {
              replaceAllText: {
                replaceText: '雪',
                containsText: {
                  text: '${snow}',
                  matchCase:true
                }
              }
            }
          ]
        }
      }).then(res => {
        printLog(`更新文档成功`, 'text-success')
        console.log(res)
        downLoadDocFile(res.result.documentId)
      })
发布了177 篇原创文章 · 获赞 875 · 访问量 25万+

猜你喜欢

转载自blog.csdn.net/github_35631540/article/details/103317299
doc