宝慕林4294392
只需按照使用 Python 的Google Docs API快速入门中的步骤操作即可。然后尝试运行此代码以使用InsertTextRequest方法插入文本:requests = [ { 'insertText': { 'location': { 'index': 25, }, 'text': text1 } }, { 'insertText': { 'location': { 'index': 50, }, 'text': text2 } }, { 'insertText': { 'location': { 'index': 75, }, 'text': text3 } },]result = service.documents().batchUpdate( documentId=DOCUMENT_ID, body={'requests': requests}).execute()要将文本插入到文档中,请使用该BatchUpdate方法并将InsertTextRequest文本和位置包含为有效负载。最好在文档中使用这种建议的方法。