Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-apps-script/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google apps script 从外部域获取Google表单中的活动用户名_Google Apps Script_Urlfetch - Fatal编程技术网

Google apps script 从外部域获取Google表单中的活动用户名

Google apps script 从外部域获取Google表单中的活动用户名,google-apps-script,urlfetch,Google Apps Script,Urlfetch,我有一个已发布的web应用程序: function doGet(request) { // DocumentApp.getActiveDocument(); SpreadsheetApp.getActive(); var about = Drive.About.get(); var user = about.name; // Logger.log(Session.getActiveUser().getEmail()); return ContentService.

我有一个已发布的web应用程序:

function doGet(request) {
   // DocumentApp.getActiveDocument();
    SpreadsheetApp.getActive();
  var about = Drive.About.get();
  var user = about.name;
  // Logger.log(Session.getActiveUser().getEmail());
   return ContentService.createTextOutput(user);
}
。。。在此URL:

这会产生用户全名所需的结果(在对用户数据的授权获得批准后-后续运行URL不会提示进行身份验证或批准)

这是我要从此应用程序脚本检索的数据:

function Test3() {
  var options = {
    'method' : 'get', 
    'followRedirects' : true,
    // 'validateHttpsCertificates' : 'true',
    'muteHttpExceptions' : true,
    'contentType' : 'null'
  };

 var url = "https://script.google.com/macros/s/AKfycbzTlhKJXrTAEPEba0l1KWqqzlkul2ntC-0iHi7_POj0wk7j3R6K/exec"

  var response = UrlFetchApp.fetch(url, options);
  // var response = test2() ;
  // var myName = response.getContentText();
  Browser.msgBox("[" + response + "]");
  }
但我还不能得到这些数据。相反,我得到了一个页面HTML文本,这相当于一个谷歌登录页面

同样,只要从浏览器手动运行URL,任何用户都会生成用户名网页,那么为什么从应用程序脚本运行时,它不能检索该网页的结果呢


我错过了什么?当然,我对获取这些数据还有一些简单的语法要求。

如果您正在寻找相关的代码,您可以在发布后检查一下。这里还有更多信息的指南。我看不出这对我的问题有什么帮助。这听起来像是允许我检索缓存信息,但我首先无法在缓存中获取响应。如果您正在查找相关代码,您可能可以在发布后检查此项。这里还有更多信息的指南。我看不出这对我的问题有什么帮助。这听起来像是允许我检索缓存信息,但我首先无法在缓存中获取响应。