Google Apps 脚本的另一个 doGet() 问题 - “未知宏 doGet"错误 [英] Another doGet() issue with Google Apps Script - "Unknown macro doGet" error

查看:25
本文介绍了Google Apps 脚本的另一个 doGet() 问题 - “未知宏 doGet"错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我显然是 Google Apps Script 的新手,不过我在 C、PHP 和 Java 编码方面有一些经验.由于我们想使用 Google Apps Script 在我们的公司中创建一个小型 CRM,因此我们需要创建一个应用程序,其中包含一个在 Google 协作平台上可用的表单.我一直在寻找这个问题的答案很长时间,不幸的是我没有找到任何答案.我有这样的代码:

I'am obviously new to Google Apps Script, nevertheless I have some experience in coding in C, PHP and Java. Since we would like to create a small CRM in our company with Google Apps Script, we need to create an application with a form available on Google Sites. I've been searching an answer for this problem a long time, I haven't unfortunately found any answer. I have a code like this:

var klienci_id = new Array(100);
var klienci_nazwa = new Array(100);
var klienci_adres = new Array(100);
var klienci_osoba = new Array(100);
var klienci_telefon = new Array(100);
var klienci_email = new Array(100);

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;
}


function main() {

 var klienci = SpreadsheetApp.openById("0ArsOaWajjzv9dEdGTUZCWFc1NnFva05uWkxETVF6Q0E");

 var kuchnia_polska = klienci.getSheetByName("Kuchnia polska");

 var dane = kuchnia_polska.getRange("D7:F22");

doGet();

}

每次我尝试发布它并输入给定的链接时,我都会收到错误未知宏 doGet".我知道当有人不使用 doGet() 函数时这是一个常见问题,但我使用了 - 但它仍然不起作用.我也相信 Google 应该创建一个关于 Google Apps Script 的完整文档,它会像 Unix 手册那样工作,因为我无法浏览所有这些该死的帮助的奇怪页面:) 它既不是 Windows 帮助,也不是一本好的手册;)

And everytime I try to publish it and enter the given link I get the error "Unknown macro doGet". I know this is a common problem when somebody doesn't use doGet() function but I do - and it still doesn't work. I also believe that Google should create a thorought documentation on Google Apps Script, which would work the way the Unix manual does, since I just cannot get through all these strange pages of goddamn help :) It's neither a Windows help, nor a good manual ;)

问候,卡米尔

推荐答案

我怀疑你做了一次版本",发布了应用程序,转到了真实"链接而不是开发"链接,并且然后添加了 doGet() 函数.当您制作一个版本时,它会冻结当时的代码.发布应用程序的版本是将在真实"链接(您提供给用户的)上运行的代码版本,它允许您继续编辑代码而不会干扰应用程序的现有用户.在发布对话框中提供了一个特殊的开发"链接,该链接始终指向最新版本的代码,但这只对您有效,其他人无效.

I have a suspicion that you made a "version" once, published the app, went to the "real" link and not the "development" link, and then added the doGet() function. When you make a version, it freezes the code at that time. The version that the app is published at is the version of the code that will run at the "real" link (what you give users), which allows you to keep editing the code without disturbing existing users of your app. There is a special "development" link given to you in the publish dialog that always refers to the most recent version of the code, but which will only work for you and no one else.

这篇关于Google Apps 脚本的另一个 doGet() 问题 - “未知宏 doGet"错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆