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で記述式の質問に字数制限を設定したい

記述式の質問には「回答の検証」を設定することができます フォームの編集画面 右下の︙メニューで「回答の検証」を選択します 検証方法には「数値」「テキスト」「長さ」「正規表現」という種類があります 今回は字数制限したいので「長さ」を選びます 長さには「最大文字数」か「最小文字数」を...