0
0

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 5 years have passed since last update.

フォームで送信した内容を任意のスプレッドシートに反映する

0
Posted at

前提

ひとつのスプレッドシートに複数のフォームが紐づいていることを想定しています。そのため、if文で、反映したいフォームにしかない質問内容が存在するか否かを判定しています。


const insertData = (e) => {
  if (e.namedValues(['KEYWORD']){
    const keyword = e.namedValues['keyword'];
    const information = e.namedValues['information'];
    const spread_id = 'YOUR_SPREAD_ID';
    const sheet_name = 'SHEET_NAME';
    const SpecificSheet = SpreadsheetApp.openById(spread_id).getSheetByName(sheet_name);
    const last_row = SpecificSheet.getLastRow();

    SpecificSheet.getRange(last_row + 1, 1).setValue(keyword);
    SpecificSheet.getRange(last_row + 1, 2).setValue(information);
  }
}

0
0
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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?