lalala
lalala

Reputation: 21

How to create google form by Spreadsheet

I want to make google form quiz by importing spreadsheets using google apps script. I want to replace 'Cell A2' -> spreadsheet's A2 and 'Cell B2 -> spreadseet's B2. please help me.

var item25 = form.addMultipleChoiceItem();
item25.setTitle('Cell A2')
item25.setChoices([
    item25.createChoice('Cell B2'),
    item25.createChoice('Cell B2')
 ])

Upvotes: 0

Views: 76

Answers (1)

ziganotschka
ziganotschka

Reputation: 26796

To access the values inside of ranges (cells) you need to retrieve

Sample:

var sheet = SpreadsheetApp.openById("paste here the id").getSheetByName("Sheet1");
var value1 = sheetgetRange("A1").getValue();
var value2 = sheetgetRange("B2").getValue();
var item25 = form.addMultipleChoiceItem();
item25.setTitle(value1)
item25.setChoices([
    item25.createChoice(value2),
    item25.createChoice(value2)
 ])

Upvotes: 1

Related Questions