简体   繁体   English

有没有办法为每个由 Gmail 帐户创建的所有 Google Forms 做一个?

[英]Is there any way to do a for each all Google Forms created by a Gmail account?

I am trying to get a list with all the google forms created by a specific google account (my own Gmail account BTW), in order to list them, get each ID and after that, be able to extract the responses spreadsheet associated to it and consolidate everything in a big home-made merge table.我正在尝试获取由特定谷歌帐户(我自己的 Gmail 帐户顺便说一句)创建的所有谷歌 forms 的列表,以便列出它们,获取每个 ID,然后,能够提取与其关联的响应电子表格和将所有内容合并到一个大型的自制合并表中。

I have tried using FormApp , but it appears to be only for just one form.我曾尝试使用FormApp ,但它似乎只适用于一种形式。 I have tried filtering all the existing files in DriveApp , but no luck at all.我尝试过滤DriveApp中的所有现有文件,但一点运气都没有。

You can use DriveApp.getFilesByType() to get all Google Forms in your drive using MimeType.GOOGLE_FORMS .您可以使用DriveApp.getFilesByType()在您的驱动器中使用MimeType.GOOGLE_FORMS获取所有 Google Forms。

Once you get all the forms, you can check its owner's email address using File.getOwner() User.getEmail() before listing all your File Ids'.获得所有 forms 后,您可以在列出所有文件 ID 之前使用File.getOwner() User.getEmail()检查其所有者的 email 地址。

After that, you can open each form using FormApp.openById() and use Form.getDestinationId() to get the response destination.之后,您可以使用FormApp.openById()打开每个表单并使用Form.getDestinationId()获取响应目标。

Sample Code:示例代码:

  var formList = DriveApp.getFilesByType(MimeType.GOOGLE_FORMS);
  var myForms = [];
  while (formList.hasNext()) {
    var form = formList.next();
    var ownerEmail = form.getOwner().getEmail();
    Logger.log(form.getName());
    Logger.log(ownerEmail);

    if(ownerEmail == "myEmail@example.com"){
      myForms.push(form.getId());
    }
  }

  myForms.forEach(id=>{
    var form = FormApp.openById(id);
    var destinationId = form.getDestinationId();
    var destinationType = form.getDestinationType();
    Logger.log(destinationId);
    Logger.log(destinationType);
  })

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用Google脚本将我所有的电子邮件从旧的Gmail帐户转发到新的Gmail帐户 - How to forward all my emails from my old gmail account to new gmail account using google script 我怎么知道Gmail帐户是Google网上论坛的成员? - How do I know a gmail account is a member of Google Groups? 有没有办法在 Google forms 上设置默认选项? - Is there any way to set default choice on a Google forms? 有什么方法可以在Google Apps脚本中获取Gmail邮件的大小? - Is there any way to get Gmail message sizes in Google Apps Script? 使用 GmailApp class 的任何 sendEmail 功能而不被列入黑名单或让我的 Gmail 帐户被 Google 停用? - Using any of the sendEmail functions for the GmailApp class without being blacklisted or having my Gmail account deactivated by Google? Google脚本:使用GMail导入的帐户发送电子邮件 - Google Scripts: send email with GMail imported account 是否可以在 Google 表单中从已登录的 Google 帐户中预先填写姓名? - Is there way to Pre-Fill name from the signed in Google Account in Google Forms? 有什么方法可以将Google Apps脚本嵌入到Gmail上下文小工具中? 我需要通过Gmail小工具访问Apps Script API功能 - Is there any way to embed Google Apps Script in a Gmail Contextual Gadget? I need to access the Apps Script API functionality from by Gmail gadget 如何为我的谷歌工作区域中的所有用户执行脚本? (我是管理员,已创建服务帐户) - How to execute a script for all users in my google workspaces domain? (I'm the admin, service account created) 从 MCC 获取所有 Google Ads 标签。 也是由其他用户在客户帐户中创建的一次 - Getting all the Google Ads Labels from MCC. Also the onces created by other users within a client account
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM