Apps Scriptリファレンス: Apps Script Reference |障害・課題追跡: IssueTracker |Google Workspace: Status Dashboard - Summary

2025年5月7日水曜日

Google Formsで1〜5段階評価の質問を作りたい


Googleフォームで1〜5段階評価の質問を作る場合は

質問の種類を「均等目盛」にします


フォームの編集画面

段階は「0」から「10」まで設定できます


今回は評価1が「Beginner」で評価5が「Expert」として作成しています


フォームの回答画面




Apps Script で作成する場合

以下の Code.gs で formName, description, title, min, max, leftLabel, rightLabel の値を書き換えて

createScaleQuestion() を実行すると

編集用のURLがログに出力されます



Code.gs
function createScaleQuestion() {
const formName = 'Google Forms Proficiency Survey';
const description = 'Please rate your Google Forms proficiency.';
const title = 'How proficient are you with Google Forms?';
const min = 1;
const max = 5;
const leftLabel = 'Beginner';
const rightLabel = 'Expert';

// Create the form
const form = FormApp.create(formName);
form.setDescription(description);

// Add scale question
const item = form.addScaleItem();
item.setTitle(title)
.setBounds(min, max)
.setLabels(leftLabel, rightLabel)
.setRequired(false);

form.setPublished(false);

Logger.log('Form Edit URL: ' + form.getEditUrl());
}





Tips

Beginner, Expert などのラベルは省略可能です

フォームの編集画面



フォームの回答画面



Reference

addScaleItem() 
setLabels(lower, upper) 

setBounds(lower, upper) 


Latest post

Google Formsのグリッドで「1 列につき 1 つの回答に制限」したい

今回はグリッドの質問で右下の︙メニューにある「1 列につき 1 つの回答に制限」を試してみます フォームの編集画面 フォームの回答画面 同じ列で2つ以上選択するとエラー表示が出るようになります それぞれの列で選択できるのはひとつだけ Apps Scriptで実装する場合に追加する...