![](/img/trans.png)
[英]How to change the text based on suggestions through GAS and Google DOC API
[英]How to create a Google Doc through the Google API
我正在开发一个基于Google App Engine Python的Web应用程序。 我需要在当前登录的用户按下按钮时在他/她的Google云端硬盘帐户中的文件夹中自动创建一个新文档。 我试图找出要利用的库。 我现在正在使用Python Client Library 3.0来管理用户的日历,但是我看不到如何使用它们来创建新文档并设置一些初始内容。 如果我可以使用一些Javascript库,那会很好,但是我对我在Internet上找到的许多不同的文档(有时是去创建的文档)(即Google Apps脚本,Google DocsList等)感到有些困惑。
您可以尝试使用以下代码使用Google App脚本创建Google文档,还可以添加文本,html内容和图像。
//Create document in google drive with given name, open the document and returns doc object
doc = DocumentApp.create('digest.doc');
//Get the document body
var body = doc.getBody();
//Insert some text into body
var text = body.editAsText();
text.insertText(0, 'This is sample text...\n');
您可以参考此链接获取API文档。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.