As a newcomer to javascript, I am in the process of developing a script for a spreadsheet that will extract specific information from it. The first obstacle I encountered was defining an array of names within the spreadsheet. An error message reading "Missing ; before statement (line 10)" is being displayed.
function readRows() {
var sheet = SpreadsheetApp.getActiveSheet();
var rows = sheet.getDataRange();
var numRows = rows.getNumRows();
//var values = rows.getValues();
var Names = sheet.getRange("A2:A7");
var NameArr = new Array(6);
var NameCell = Names.getCell(1, 1);
NameArr[0] = NameCell.getValue(); // <-- Here lies the problem
NameCell = Names.getCell(2, 1);
NameArr[1] = NameCell.getValue();
NameCell = Names.getCell(3, 1);
NameArr[2] = NameCell.getValue();
NameCell = Names.getCell(4, 1);
NameArr[3] = NameCell.getValue();
NameCell = Names.getCell(5, 1);
NameArr[4] = NameCell.getValue();
NameCell = Names.getCell(6, 1);
NameArr[5] = NameCell.getValue();
// ...
}