title: How to make google app script - calendar createEvent() to accept GSheet inputs from cells populated using array formula
body: <p>A few days ago I got help from stack overflow to modify my then app script code used to make calendar events from info on google sheet, so as to tick a checkbox whenever an entry from the corresponding row is made and subsequently make new events only when the checkbox is unticked.</p>
  <pre><code>function addEvent() {
    let webinarCalendar = CalendarApp.getCalendarById(&quot;blablablablablabla@gmail.com&quot;);
    let calendarSheet = SpreadsheetApp.getActiveSheet();
    let schedule = calendarSheet.getDataRange().getValues();
    schedule.splice(0, 1);
  
    const k = 16; // colIndex of checkbok col
    const created = schedule.map(e =&gt; [e[k]]);
    schedule.forEach(function(entry, i) {
      if (entry[k] == true) { return; }
      webinarCalendar.createEvent(entry[3], entry[14], entry[15], {description: entry[13]});
      created[i][0] = true;
    });
    calendarSheet.getRange(2, k + 1, created.length, 1).setValues(created);
  }
  </code></pre>
  <p>This current code worked just fine until 2 days ago when I updated 3 of the 4 cells with the required inputs to work on an array formula so that they get populated automatically whenever a new row entry is made.</p>
  <p>The error on the app script console says : <strong>Exception: The parameters (String,String,String,(class)) don't match the method signature for CalendarApp.Calendar.createEvent.</strong></p>
  <p>The parameters required for this createEvent() as per documentation are title(string), start time(string), finish time(string) and description(which is inside a javascript object I think and is also a string). To ensure that the datatype did not somehow get changed in the process of creating array formula, I cross checked the cells with an <strong>ISTEXT()</strong> and all of the inputs returned <strong>TRUE</strong>.</p>
  <p>Second trial that I made was to change the splice() from (0,1) to (0,2) so that it ignores the first row which has the array formula written into the cells, which also did not fix the issue.</p>
  <p>I would greatly appreciate if someone could show me what is causing this issue and help me fix it.</p>