Reputation: 291
To get column headers, this worked (ColHeaderValues = sheeResponses.getDataRange().getValues().shift();).
Is there a similar method to get the row headers?
Do I have to create and populate a two dimensional array to do this?
What I am trying to accomplish is being able to reference a specific row number by looking up the value in column one.
Thanks, chuck
Upvotes: 0
Views: 60
Reputation: 95
You can do
RowHeaderValues = sheetResponses.getDataRange().getValues().map(function(row){return row[0]});
Upvotes: 1
Reputation: 8699
You can use the find function of the 2D Arrays Library: https://sites.google.com/site/scriptsexamples/custom-methods/2d-arrays-library
find(Object[][] data, intColumnIndex, String value): int
var data = sheetResponses.getDataRange().getValues();
ArrayLib.find(data, 0, "valueInColumnOne");
Upvotes: 1