indexOf returning -1 despite object being in the array - Javascript in Google Spreadsheet Scripts
I am writing a script for a Google Docs Spreadsheet to read a list of directors and add them to an array if they do not already appear within it. However, I cannot seem to get indexOf to return anything other than -1 for elements that are contained within the array. Can anyone tell me what I am doing wrong? Or point me to an easier way of doing this? This is my script: function readRows() { var column = SpreadsheetApp.getActiveSpreadsheet().getRangeByName("Director"); var values = column.getValues(); var numRows = column.getNumRows(); var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet =