lalala
lalala

Reputation: 21

Get Cell and settitle 'Cell'

I get 'Cell A2' and I want make settitle 'A2 ' How to do? please help me

function MyFunction() {
    var sheet = SpreadsheetApp.getActiveSheet();

    var value1 = sheet.getRange('A2').getValue();

    var form = FormApp.openByUrl("my form url");
    var item25 = form.addMultipleChoiceItem();
    item25.setTitle('A2')
    item25.setChoices([
        item25.createChoice('B2'),
        item25.createChoice('B2')
    ])
    // ....
}

Upvotes: 0

Views: 47

Answers (1)

Jescanellas
Jescanellas

Reputation: 2608

Do item25.setTitle(value1) instead of item25.setTitle('A2').

Otherwise you are not using the variable value1.

If you take a look at the documentation, getValue returns an object (I suppose an string in this case) and setTitle requires an string, so you can use value1 in setTitle.

I recommend you to take a look at some javascript documentation, like variables and data type.

Upvotes: 1

Related Questions