簡體   English   中英

如何從 Google 表單提交按鈕運行 Google 表單腳本?

[英]How to run Google sheet script from the Google form submit button?

我在谷歌表單中有一個關於從用戶那里獲取數據的表單,在用戶以谷歌表單提交他/她的信息並向他們發送驗證短信后,我需要從谷歌表單中獲取用戶的電話號碼。

我想獲得一個提交按鈕的事件表單,谷歌在其紀錄片中有一個提交 function 但我不知道它是如何工作的,或者我該如何使用它,因為那里沒有例子!

我為此編寫了所有代碼,我只需要與提交按鈕交談。

您可以使用以下 function -

function onFormSubmit(e) {
  var formItems = FormApp.getActiveForm().getItems();

  var userPhoneNumber = e.response.getResponseForItem(formItems[x]).getResponse();
  // replace 'x' with 0 if phone number is the first item or
  // with the actual number depending on the nth item of your form
  // (i.e. if userPhoneNumber is the 2nd item, replace x with 1,
  // if its the 3rd item, replace x with 2 etc.)


  // now you write your function to trigger SMS to the 'userPhoneNumber' value
}

希望這可以幫助。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM