2012-09-09 40 views
0

只需要一点帮助就可以开始...Google网站中的脚本失败

我试图在Google网站上运行此Google示例脚本,但它不起作用。

我没有按照本教程中建议的程序...... https://developers.google.com/apps-script/articles/getting-started-with-sites

function doGet(e) { 
    var app = UiApp.createApplication(); 
    // hello world label 
    var helloworldLabel = app.createLabel("I love Apps Script!").setStyleAttribute("fontSize","16px"); 
    // add the label to the app container 
    app.add(helloworldLabel); 
    return app; 
} 

在法国;;;错误信息:GOOGLE DRIVEDésolé,la page(ou le document)que vous souhaitez afficher n'existe pas。 Vérifiezl'adresse,puisréessayez。
“Google云端硬盘对不起,该页面(文档)doensn't存在” ......

我可能会错过一些很基本的...

当我直接在脚本编辑器中运行这个其他代码,它工作正常...

function sendEmail() 
{ 
    MailApp.sendEmail('[email protected]', 'Salut !', 'Ce message est envoyé par des scripts Google Apps. Chouette non ?'); 
} 

感谢您的帮助。

+1

你能发布确切的错误信息吗?这有助于我们找到有类似问题的人。 –

+0

法语错误信息;;; :Désolé,la page(ou le document)que vous souhaitez afficher n'existe pas。 Vérifiezl'adresse,puisréessayez。 – user1657722

回答

0

最近发布(相当)web应用程序的方式有所变化:see docs:“要将脚本作为Google Apps脚本小工具嵌入到Google协作平台,您必须首先将脚本部署为网页应用程序“

似乎旧脚本可以在插入页面时直接运行,但新插件必须在作为小工具插入之前发布。文档不是很清楚,但一些测试似乎证实这一步是必要的(创建版本/发布为webapp)。
当您将webapp作为嵌入式小工具运行时考虑权限和身份考虑因素时,这很有意义。

+0

非常感谢!就是这样,现在就起作用了。 – user1657722

+0

很高兴帮助... :-)可能你应该在你的代码中掩盖你的个人电子邮件,发布个人数据从来都不是好主意,即使在这里!也请考虑将此帖标记为已回答 –