Lucas
Lucas

Reputation: 3

How can I get values from a range of cells to show up in a message box?

I'm trying to show the values from O1 until O28 but I am only getting from O1 using the code below.

    function TEST() {
  var sheet = SpreadsheetApp.getActiveSpreadsheet();
  var range = sheet.getRange('O1:O28');
  var value = range.getValue();
  Browser.msgBox(value);
};

Any suggestions please?

Upvotes: 0

Views: 223

Answers (2)

Cooper
Cooper

Reputation: 64072

function TEST() {
  var sheet = SpreadsheetApp.getActiveSpreadsheet();
  var range = sheet.getRange('O1:O28');
  var vs = range.getDisplayValues()[0];
  Browser.msgBox(vs.join(','));
};

Upvotes: 1

Daniel H.
Daniel H.

Reputation: 680

Try using .getValues instead of .getValue.

Documentation for .getValue

Documentation for .getValues.

Upvotes: 0

Related Questions