// Add a checkbox grid item to a form and require one response per column.
const form = FormApp.openById('123abc');
const checkboxGridItem = form.addCheckboxGridItem();
checkboxGridItem.setTitle('Where did you celebrate New Years?')
.setRows(['New York', 'San Francisco', 'London'])
.setColumns(['2014', '2015', '2016', '2017']);
const checkboxGridValidation = FormApp.createCheckboxGridValidation()
.setHelpText('Select one item per column.')
.requireLimitOneResponsePerColumn()
.build();
checkboxGridItem.setValidation(checkboxGridValidation);
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-11-26 UTC."],[[["`CheckboxGridValidation` is used to set validation rules specifically for `CheckboxGridItem` within Google Forms."],["It allows you to enforce constraints like requiring exactly one response per column in a checkbox grid, enhancing data integrity and user experience."],["You can customize the validation with help text to guide users on expected input."]]],[]]