drj58429 2019-04-15 12:51
浏览 126

如何使用PHP中的API获取与谷歌表链接的谷歌表格。 或与谷歌表格链接的表格

How to get google form linked with google sheet using api in php. or Google sheet linked to form.

I have list of Google form using API and I want to get the Google sheet used to save responses of form. Or I have also list of google sheets is there way I can get form id linked with google sheet.

  • 写回答

1条回答 默认 最新

  • dongpin4611 2019-04-17 23:15
    关注

    Run this in any spreadsheet and it will list each of the sheets and, if a sheet is linked to a form, it will list the url, ID and Title of the linked form.


      function LoopSheets4Forms(){
          var ss = SpreadsheetApp.getActiveSpreadsheet();
          var sheets = ss.getSheets();
          var numSheets = sheets.length
          if (numSheets > 1) {
            for (i=0;i<numSheets;i++){
              var sheetname = sheets[i].getName();
              Logger.log("DEBUG:i="+i+", Sheet name: "+ sheetname);//DEBUG
              var formURL =  sheets[i].getFormUrl();
              if(formURL != null){
                // not null
                Logger.log("DEBUG:Form url:"+formURL);//DEBUG
                var form = FormApp.openByUrl(formURL);
                Logger.log("DEBUG:Form title: "+form.getTitle());//DEBUG
                var formId = form.getId();
                Logger.log("DEBUG:Form id: "+ formId );//DEBUG
              }
              else
              {
                // is null
                Logger.log("DEBUG: this sheet not linked to a form");//DEBUG
              }
            }
          }
        }
    
    评论

报告相同问题?

悬赏问题

  • ¥15 vscode的问题提问
  • ¥50 切换TabTip键盘的输入法
  • ¥15 可否在不同线程中调用封装数据库操作的类
  • ¥15 微带串馈天线阵列每个阵元宽度计算
  • ¥15 keil的map文件中Image component sizes各项意思
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM