Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-apps-script/6.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 - Fatal编程技术网

Google apps script google应用程序脚本保存复选框字符串

Google apps script google应用程序脚本保存复选框字符串,google-apps-script,Google Apps Script,我是谷歌应用程序脚本的新手,我需要的是保存复选框字符串。如果复选框为true,那么我想为它保存值字符串 例如,我添加了两个复选框 邮件和女性如果我选中邮件复选框,我想保存邮件字符串,而不是它是真是假 这是我的密码 // Save Data function submitData() { var ss = SpreadsheetApp.getActiveSpreadsheet(); var formSS = ss.getSheetByName("D

我是谷歌应用程序脚本的新手,我需要的是保存复选框字符串。如果复选框为true,那么我想为它保存值字符串

例如,我添加了两个复选框

邮件和女性如果我选中邮件复选框,我想保存邮件字符串,而不是它是真是假

这是我的密码

 // Save Data
     function submitData() {


     var ss  = SpreadsheetApp.getActiveSpreadsheet();
     var formSS  = ss.getSheetByName("Data Entry"); //Form Sheet
     var datasheet = ss.getSheetByName("Data"); //Data Sheet

      //Input Values
    var values = [[formSS.getRange("C5").getValue(),

    // get the checkbox value
             formSS.getRange("G5").getValue(), 

     // get the checkbox string value = mail

           formSS.getRange("I7").getValue(),

        // get the checkbox value

             formSS.getRange("J7").getValue(),

       // get the checkbox string value = female

             formSS.getRange("K7").getValue() ,
            
            

                   ]];
            
            
            
            datasheet.getRange(datasheet.getLastRow()+1, 2, 1, 4).setValues(values);
          SpreadsheetApp.getUi().alert(' "New Data Saved  ) );     
            
          }            

通过此数据验证:

该代码:

function onEdit(e) {
  //e.source.toast("Entry");
  //console.log(JSON.stringify(e));
  const sh=e.range.getSheet();
  if(sh.getName()=="Sheet1" && e.range.columnStart==3 && e.value) {
    e.range.offset(0,1).setValue(e.value);
  }
}
在编辑第3列时,您将获得此表: