0
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

GoogleAppsScriptでdoGet()をdebugする

Last updated at Posted at 2021-04-20

手順

  1. doGet()を実行する関数を定義する
  2. 1の関数内でパラメータを定義しdoGet()の引数に渡す
  3. 「実行する関数」に1の関数を選択し実行する

コード

get.gs
function debug(){
  const e = {
    parameter:{
      hoge: 'foo',
      fuga: "baa"
    }
  }
  doGet(e)
}

function doGet(e){
  var param = e.parameter

  console.log(param.hoge) //foo
  console.log(param.fuga) //baa
}

これは

https://script.google.com/macros/(中略)/exec?hoge=foo&fuga=bar

を叩いた際のアクションと同等となります。

参考

GASでwebアプリの作成とパラメータの確認方法(doGet、doPost)

0
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?