在javascript中向Google工作表插入数据

在javascript中向Google工作表插入数据,javascript,jquery,Javascript,Jquery,我正在尝试将post请求数据保存到google电子表格中。但是,数据保存为未定义 原始帖子使用表单并使用jquery。请参阅下面的链接。但我也尝试在不使用jquery的情况下传递数组 我正在使用以下应用程序脚本而不使用jquery- 我把代码贴在这里 function sendData(data) { var xmlhttp = new XMLHttpRequest(); // new HttpRequest instance var theUrl = "spreadshe

我正在尝试将post请求数据保存到google电子表格中。但是,数据保存为未定义

原始帖子使用表单并使用jquery。请参阅下面的链接。但我也尝试在不使用jquery的情况下传递数组

我正在使用以下应用程序脚本而不使用jquery-

我把代码贴在这里

function sendData(data) {
    var xmlhttp = new XMLHttpRequest();   // new HttpRequest instance 
    var theUrl = "spreadsheeturl";
    xmlhttp.open("post", theUrl);
    //xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
    xmlhttp.send(JSON.stringify(data))
    }

我找到了答案,如果要传递JSON数据,必须取消应用程序脚本中的块注释