title: How to read a spreadsheet vertically
body: <p>I am working in Google Scripts in combination with Google spreadsheets. The idea is that I make a spreadsheet that is able to read out events in a calendar. I am able to read to through the sheet horizontally, however I want to be able to read through it vertically.</p>
  
  <p>See the script I have so far below.</p>
  
  <pre><code>function caltest1() {
      var sheet = SpreadsheetApp.getActiveSheet();
      var startRow = 23;  // First row of data to process
      var numRows = 2;   // Number of rows to process
      var dataRange = sheet.getRange(startRow, 1, numRows, 10);
      var data = dataRange.getValues();
      var cal = CalendarApp.getDefaultCalendar();
  
      for (i in data) {
          var row = data[i];
          var tstart = new Date(row[1]);
          var tstop = new Date(row[7]);
          var title = row[0];  // First column
          var desc = row[2];       // Second column
          var guest = row[8];
          var loc = row[9];
          cal.createEvent(title, tstart, { description: desc, location: loc, sendInvites: true, guests: guest });
      }
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/Avt6A.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Avt6A.png" alt="enter image description here"></a></p>