I want to set the header row range as an array of header names.In VBA I would write myArray = myRange.Value where myRange would be the range of the headers in row 1.I am trying:var sSheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('ShtName');var Range = sSheet.getRange(1, 1, 1, sSheet.getLastColumn());var Values = []var Values = Range.getValues();But Values does not seem to be an Array.
Set Header row range as Array of header names in Google Sheets
google spreadsheets;google apps script
The method getValues returns a double array: for example, [[1, 2], [3, 4]] where 1, 2 is the first row of the range and 3, 4 is the second. This applies even if the range has just one row: the output will be [[1, 2]]. So, in your setup you would use Values[0] as the array of headers. The headers are Values[0][0], Values[0][1], and so on.