function buildForm_() {
  let ss = SpreadsheetApp.getActiveSpreadsheet();
  if (ss.getFormUrl()) {
    let msg = 'Form already exists. Unlink the form and try again.';
    SpreadsheetApp.getUi().alert(msg);
    return;
  }
  let form = FormApp.create('Activity Signup')
      .setDestination(FormApp.DestinationType.SPREADSHEET, ss.getId())
      .setAllowResponseEdits(true)
      .setLimitOneResponsePerUser(true)
      .setCollectEmail(true);
  let sectionHelpText = Utilities.formatString('Please choose your top %d activities',
      NUM_ITEMS_TO_RANK);
  form.addSectionHeaderItem()
      .setTitle('Activity choices')
      .setHelpText(sectionHelpText);

  // Presents activity ranking as a form grid with each activity as a row and rank as a column.
  let rows = loadActivitySchedule_(ss).map(function(activity) {
    return activity.description;
  });
  let columns = range_(1, NUM_ITEMS_TO_RANK).map(function(value) {
    return Utilities.formatString('%s', toOrdinal_(value));
  });
  let gridValidation = FormApp.createGridValidation()
      .setHelpText('Select one item per column.')
      .requireLimitOneResponsePerColumn()
      .build();
  form.addGridItem()
      .setColumns(columns)
      .setRows(rows)
      .setValidation(gridValidation);

  form.addListItem()
      .setTitle('Assign other activities if choices are not available?')
      .setChoiceValues(['Yes', 'No']);
}
Builds a form based on the "Activity Schedule" sheet. The form asks attendees to rank their top
N choices of activities, where N is defined by NUM_ITEMS_TO_RANK.