如何使用cURL将文本文件发送到GAS?
我想使用cURL将文本文件的内容发送到Google电子表格 test.txt如何使用cURL将文本文件发送到GAS?,curl,google-apps-script,google-sheets,Curl,Google Apps Script,Google Sheets,我想使用cURL将文本文件的内容发送到Google电子表格 test.txt this is the message from local 关于局部壳 curl -F name=value -F data1=@test.txt "https://script.google.com/macros/s/xxxxxxxxxxxxxxxxxxxxxxxxxxx/exec" 在谷歌电子数据表中的谷歌应用程序脚本中 function doPost(e){ Logger.log(e); } 那么
this is the message from local
关于局部壳
curl -F name=value -F data1=@test.txt "https://script.google.com/macros/s/xxxxxxxxxxxxxxxxxxxxxxxxxxx/exec"
在谷歌电子数据表中的谷歌应用程序脚本中
function doPost(e){
Logger.log(e);
}
那么日志就是
Fri Jul 12 08:34:28 PDT 2013 INFO: {queryString=null, parameter={name=value}, contextPath=, parameters={name=[value]}, contentLength=316}
我找不到我发送的参数“data1”
那么我怎样才能收到我发送的文件的内容呢
提前感谢您。我可以使用而不是 命令
curl --data-urlencode name=value --data-urlencode data2@test.txt "https://script.google.com/macros/s/xxxxxxxxxxxxxx/exec" -L --insecure
输出
{"queryString":null,"postData":{"contents":"name=value&data1=This%20is%20the%20content%20of%20my%20test.txt%20file","type":"application/x-www-form-urlencoded","name":"postData","length":70},"parameter":{"data1":"This is the content of my test.txt file","name":"value"},"contextPath":"","parameters":{"data1":["This is the content of my test.txt file"],"name":["value"]},"contentLength":70}
应用程序脚本
function doPost(e) {
var xx = ContentService.createTextOutput(JSON.stringify(e)).setMimeType(ContentService.MimeType.TEXT);
return xx;
}
我可以使用而不是 命令
curl --data-urlencode name=value --data-urlencode data2@test.txt "https://script.google.com/macros/s/xxxxxxxxxxxxxx/exec" -L --insecure
输出
{"queryString":null,"postData":{"contents":"name=value&data1=This%20is%20the%20content%20of%20my%20test.txt%20file","type":"application/x-www-form-urlencoded","name":"postData","length":70},"parameter":{"data1":"This is the content of my test.txt file","name":"value"},"contextPath":"","parameters":{"data1":["This is the content of my test.txt file"],"name":["value"]},"contentLength":70}
应用程序脚本
function doPost(e) {
var xx = ContentService.createTextOutput(JSON.stringify(e)).setMimeType(ContentService.MimeType.TEXT);
return xx;
}