Help us understand the problem. What is going on with this article?

Google Apps ScriptからHTTP POST

More than 5 years have passed since last update.

Google Driveのスプレットシートをハックしようと思って勉強してます。

ここのサンプルをもとに書いたらあっさりいけました。
Class UrlFetchApp - Google Apps Script — Google Developers -

サンプルリクエスト例

curl http://example.com -X POST -d 'message=google apps scriptより'

Google Apps Scriptで書くとこんな感じ

httppost.gs
/* 
* messageをpostする関数
*/
function sendHttpPost(message){
   var payload =
   {
     "message" : message
   };

   var options =
   {
     "method" : "post",
     "payload" : payload
   };

   UrlFetchApp.fetch("http://example.com", options);
}

function myFunction(){
  var message = 'google apps scriptより';
  sendHttpPost(message);
}

めちゃカンタンですね。

n0bisuke
プロトタイピング専門スクール「プロトアウトスタジオ」で教えたりしてます。 プロフ -> https://dotstud.io/members/n0bisuke
https://protoout.studio
dotstudio
全ての人がモノづくりを楽しむ世界を目指して活動しています。
https://dotstud.io
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした