I work for a property management company that both manages owners' properties and rents them out to guests. We wanted a way to get to know each of our owners and better prepare for their arrivals. With this goal in mind, I created a project called Show Me You Know Me. This project consists of individual Google Docs for each owner we manage and one Google Sheet. The spreadsheet has a sheet with all the upcoming arrivals on it and a sheet with all the IDs for the docs and their corresponding unit numbers. The function is designed to look at the arrivals, determine if any of them are owners ('o') arriving tomorrow, and if so, attach their docs to an email and send it out. I would like it to do this once a day. It works as intended when I run it manually, but times out every time I try to trigger it. Is there a way to make my code faster?

```
`function sendEmail() {
  var ss = SpreadsheetApp.getActiveSpreadsheet(); 
  var arrivals = ss.getSheetByName('Arrivals'); 
  var ids = ss.getSheetByName('IDs'); 
  var lastrow = arrivals.getLastRow(); // find the last row 
  var datarange = arrivals.getRange(2, 1, lastrow, 5).getDisplayValues(); 
  var list = []; // create a blank list to store the attachment IDs
  for (var i in datarange) { 
    var rowstart = 2; 
    var row = datarange[i]; // get the corresponding row
    var difdate = row[3]; // fetch the days to arrival 
    var unitnum = row[1]; // fetch the unit number
    var type = row[4]; // fetch the arrival type 
    if (difdate == 1 && type == 'o'){ // if an owner is arriving tomorrow
      do {
        rowstart++; } 
      while (unitnum != ids.getRange(rowstart, 1).getValue()); 
      if (unitnum == ids.getRange(rowstart, 1).getValue()) {
    list.push(DriveApp.getFileById(ids.getRange(rowstart,2).getValue()));
      }
    }
  }
  if (list.length > 0) { // if there's at least one thing on the list
    MailApp.sendEmail('email@email.com', 'Show Me You Know Me', 'Read 
    about the owners arriving tomorrow!', {attachments: list});`

```

Here's my Execution Transcript:

```
[19-05-15 10:40:31:406 MDT] Starting execution
[19-05-15 10:40:31:416 MDT] SpreadsheetApp.getActiveSpreadsheet() [0 seconds]
[19-05-15 10:40:31:548 MDT] Spreadsheet.getSheetByName([Arrivals]) [0.131 seconds]
[19-05-15 10:40:31:550 MDT] Spreadsheet.getSheetByName([IDs]) [0.001 seconds]
[19-05-15 10:40:31:712 MDT] Sheet.getLastRow() [0.161 seconds]
[19-05-15 10:40:31:714 MDT] Sheet.getRange([2, 1, 5, 5]) [0.001 seconds]
[19-05-15 10:40:31:850 MDT] Range.getDisplayValues() [0.135 seconds]
[19-05-15 10:40:31:852 MDT] Sheet.getRange([3, 1]) [0.001 seconds]
[19-05-15 10:40:31:968 MDT] Range.getValue() [0.115 seconds]
[19-05-15 10:40:31:974 MDT] Sheet.getRange([4, 1]) [0.001 seconds]
[19-05-15 10:40:31:975 MDT] Range.getValue() [0 seconds]
[19-05-15 10:40:31:976 MDT] Sheet.getRange([5, 1]) [0 seconds]
[19-05-15 10:40:31:976 MDT] Range.getValue() [0 seconds]
[19-05-15 10:40:31:977 MDT] Sheet.getRange([6, 1]) [0 seconds]
[19-05-15 10:40:31:977 MDT] Range.getValue() [0 seconds]
[19-05-15 10:40:31:978 MDT] Sheet.getRange([7, 1]) [0 seconds]
[19-05-15 10:40:31:978 MDT] Range.getValue() [0 seconds]
[19-05-15 10:40:31:979 MDT] Sheet.getRange([8, 1]) [0 seconds]
[19-05-15 10:40:31:979 MDT] Range.getValue() [0 seconds]
[19-05-15 10:40:31:979 MDT] Sheet.getRange([9, 1]) [0 seconds]
[19-05-15 10:40:31:980 MDT] Range.getValue() [0 seconds]
[19-05-15 10:40:31:980 MDT] Sheet.getRange([10, 1]) [0 seconds]
[19-05-15 10:40:31:980 MDT] Range.getValue() [0 seconds]
[19-05-15 10:40:31:981 MDT] Sheet.getRange([11, 1]) [0 seconds]
[19-05-15 10:40:31:981 MDT] Range.getValue() [0 seconds]
[19-05-15 10:40:31:982 MDT] Sheet.getRange([12, 1]) [0 seconds]
[19-05-15 10:40:31:982 MDT] Range.getValue() [0 seconds]
[19-05-15 10:40:31:983 MDT] Sheet.getRange([13, 1]) [0 seconds]
[19-05-15 10:40:31:983 MDT] Range.getValue() [0 seconds]
[19-05-15 10:40:31:983 MDT] Sheet.getRange([14, 1]) [0 seconds]
[19-05-15 10:40:31:983 MDT] Range.getValue() [0 seconds]
[19-05-15 10:40:31:984 MDT] Sheet.getRange([15, 1]) [0 seconds]
[19-05-15 10:40:31:984 MDT] Range.getValue() [0 seconds]
[19-05-15 10:40:31:984 MDT] Sheet.getRange([16, 1]) [0 seconds]
[19-05-15 10:40:31:985 MDT] Range.getValue() [0 seconds]
[19-05-15 10:40:31:985 MDT] Sheet.getRange([17, 1]) [0 seconds]
[19-05-15 10:40:31:985 MDT] Range.getValue() [0 seconds]
[19-05-15 10:40:31:986 MDT] Sheet.getRange([18, 1]) [0 seconds]
[19-05-15 10:40:31:986 MDT] Range.getValue() [0 seconds]
[19-05-15 10:40:31:987 MDT] Sheet.getRange([19, 1]) [0 seconds]
[19-05-15 10:40:31:987 MDT] Range.getValue() [0 seconds]
[19-05-15 10:40:31:988 MDT] Sheet.getRange([20, 1]) [0 seconds]
[19-05-15 10:40:31:988 MDT] Range.getValue() [0 seconds]
[19-05-15 10:40:31:988 MDT] Sheet.getRange([21, 1]) [0 seconds]
[19-05-15 10:40:31:988 MDT] Range.getValue() [0 seconds]
[19-05-15 10:40:31:989 MDT] Sheet.getRange([22, 1]) [0 seconds]
[19-05-15 10:40:31:989 MDT] Range.getValue() [0 seconds]
[19-05-15 10:40:31:990 MDT] Sheet.getRange([23, 1]) [0 seconds]
[19-05-15 10:40:31:990 MDT] Range.getValue() [0 seconds]
[19-05-15 10:40:31:991 MDT] Sheet.getRange([24, 1]) [0 seconds]
[19-05-15 10:40:31:991 MDT] Range.getValue() [0 seconds]
[19-05-15 10:40:31:992 MDT] Sheet.getRange([25, 1]) [0 seconds]
[19-05-15 10:40:31:992 MDT] Range.getValue() [0 seconds]
[19-05-15 10:40:31:993 MDT] Sheet.getRange([26, 1]) [0 seconds]
[19-05-15 10:40:31:993 MDT] Range.getValue() [0 seconds]
[19-05-15 10:40:31:993 MDT] Sheet.getRange([27, 1]) [0 seconds]
[19-05-15 10:40:31:994 MDT] Range.getValue() [0 seconds]
[19-05-15 10:40:31:994 MDT] Sheet.getRange([28, 1]) [0 seconds]
[19-05-15 10:40:31:994 MDT] Range.getValue() [0 seconds]
[19-05-15 10:40:31:995 MDT] Sheet.getRange([29, 1]) [0 seconds]
[19-05-15 10:40:31:995 MDT] Range.getValue() [0 seconds]
[19-05-15 10:40:31:995 MDT] Sheet.getRange([30, 1]) [0 seconds]
[19-05-15 10:40:31:995 MDT] Range.getValue() [0 seconds]
[19-05-15 10:40:31:996 MDT] Sheet.getRange([31, 1]) [0 seconds]
[19-05-15 10:40:31:996 MDT] Range.getValue() [0 seconds]
[19-05-15 10:40:31:996 MDT] Sheet.getRange([32, 1]) [0 seconds]
[19-05-15 10:40:31:997 MDT] Range.getValue() [0 seconds]
[19-05-15 10:40:31:997 MDT] Sheet.getRange([33, 1]) [0 seconds]
[19-05-15 10:40:31:997 MDT] Range.getValue() [0 seconds]
[19-05-15 10:40:31:998 MDT] Sheet.getRange([34, 1]) [0 seconds]
[19-05-15 10:40:31:998 MDT] Range.getValue() [0 seconds]
[19-05-15 10:40:31:999 MDT] Sheet.getRange([35, 1]) [0 seconds]
[19-05-15 10:40:31:999 MDT] Range.getValue() [0 seconds]
[19-05-15 10:40:31:999 MDT] Sheet.getRange([36, 1]) [0 seconds]
[19-05-15 10:40:32:000 MDT] Range.getValue() [0 seconds]
[19-05-15 10:40:32:000 MDT] Sheet.getRange([37, 1]) [0 seconds]
[19-05-15 10:40:32:000 MDT] Range.getValue() [0 seconds]
[19-05-15 10:40:32:001 MDT] Sheet.getRange([38, 1]) [0 seconds]
[19-05-15 10:40:32:001 MDT] Range.getValue() [0 seconds]
[19-05-15 10:40:32:002 MDT] Sheet.getRange([39, 1]) [0 seconds]
[19-05-15 10:40:32:002 MDT] Range.getValue() [0 seconds]
[19-05-15 10:40:32:002 MDT] Sheet.getRange([40, 1]) [0 seconds]
[19-05-15 10:40:32:002 MDT] Range.getValue() [0 seconds]
[19-05-15 10:40:32:003 MDT] Sheet.getRange([41, 1]) [0 seconds]
[19-05-15 10:40:32:003 MDT] Range.getValue() [0 seconds]
[19-05-15 10:40:32:004 MDT] Sheet.getRange([42, 1]) [0 seconds]
[19-05-15 10:40:32:004 MDT] Range.getValue() [0 seconds]
[19-05-15 10:40:32:005 MDT] Sheet.getRange([43, 1]) [0 seconds]
[19-05-15 10:40:32:005 MDT] Range.getValue() [0 seconds]
[19-05-15 10:40:32:006 MDT] Sheet.getRange([44, 1]) [0 seconds]
[19-05-15 10:40:32:006 MDT] Range.getValue() [0 seconds]
[19-05-15 10:40:32:006 MDT] Sheet.getRange([45, 1]) [0 seconds]
[19-05-15 10:40:32:007 MDT] Range.getValue() [0 seconds]
[19-05-15 10:40:32:007 MDT] Sheet.getRange([46, 1]) [0 seconds]
[19-05-15 10:40:32:007 MDT] Range.getValue() [0 seconds]
[19-05-15 10:40:32:008 MDT] Sheet.getRange([47, 1]) [0 seconds]
[19-05-15 10:40:32:008 MDT] Range.getValue() [0 seconds]
[19-05-15 10:40:32:009 MDT] Sheet.getRange([48, 1]) [0 seconds]
[19-05-15 10:40:32:009 MDT] Range.getValue() [0 seconds]
[19-05-15 10:40:32:009 MDT] Sheet.getRange([49, 1]) [0 seconds]
[19-05-15 10:40:32:009 MDT] Range.getValue() [0 seconds]
[19-05-15 10:40:32:010 MDT] Sheet.getRange([50, 1]) [0 seconds]
[19-05-15 10:40:32:010 MDT] Range.getValue() [0 seconds]
[19-05-15 10:40:32:011 MDT] Sheet.getRange([51, 1]) [0 seconds]
[19-05-15 10:40:32:011 MDT] Range.getValue() [0 seconds]
[19-05-15 10:40:32:012 MDT] Sheet.getRange([52, 1]) [0 seconds]
[19-05-15 10:40:32:012 MDT] Range.getValue() [0 seconds]
[19-05-15 10:40:32:012 MDT] Sheet.getRange([53, 1]) [0 seconds]
[19-05-15 10:40:32:012 MDT] Range.getValue() [0 seconds]
[19-05-15 10:40:32:013 MDT] Sheet.getRange([54, 1]) [0 seconds]
[19-05-15 10:40:32:013 MDT] Range.getValue() [0 seconds]
[19-05-15 10:40:32:014 MDT] Sheet.getRange([55, 1]) [0 seconds]
[19-05-15 10:40:32:014 MDT] Range.getValue() [0 seconds]
[19-05-15 10:40:32:015 MDT] Sheet.getRange([56, 1]) [0 seconds]
[19-05-15 10:40:32:015 MDT] Range.getValue() [0 seconds]
[19-05-15 10:40:32:015 MDT] Sheet.getRange([57, 1]) [0 seconds]
[19-05-15 10:40:32:015 MDT] Range.getValue() [0 seconds]
[19-05-15 10:40:32:016 MDT] Sheet.getRange([58, 1]) [0 seconds]
[19-05-15 10:40:32:016 MDT] Range.getValue() [0 seconds]
[19-05-15 10:40:32:017 MDT] Sheet.getRange([59, 1]) [0 seconds]
[19-05-15 10:40:32:017 MDT] Range.getValue() [0 seconds]
[19-05-15 10:40:32:017 MDT] Sheet.getRange([60, 1]) [0 seconds]
[19-05-15 10:40:32:018 MDT] Range.getValue() [0 seconds]
[19-05-15 10:40:32:018 MDT] Sheet.getRange([60, 1]) [0 seconds]
[19-05-15 10:40:32:018 MDT] Range.getValue() [0 seconds]
[19-05-15 10:40:32:019 MDT] Sheet.getRange([60, 2]) [0 seconds]
[19-05-15 10:40:32:019 MDT] Range.getValue() [0 seconds]
[19-05-15 10:40:32:319 MDT] DriveApp.getFileById([15fjNaZy7sl-42D0ZXcct_fHvy8JKnBPkQiiaGeF6wgw]) [0.299 seconds]
[19-05-15 10:40:32:322 MDT] File.getBlob() [0.001 seconds]
[19-05-15 10:40:34:891 MDT] File.getBlob() [0.002 seconds]
[19-05-15 10:40:34:893 MDT] File.getBlob() [0.001 seconds]
[19-05-15 10:40:37:033 MDT] Blob.getName() [0 seconds]
[19-05-15 10:40:37:044 MDT] Blob.getBytes() [0.01 seconds]
[19-05-15 10:40:37:052 MDT] File.getBlob() [0.002 seconds]
[19-05-15 10:40:39:683 MDT] Blob.getName() [0 seconds]
[19-05-15 10:40:39:684 MDT] Blob.getContentType() [0 seconds]
[19-05-15 10:40:39:988 MDT] MailApp.sendEmail([email@email.com, Show Me You Know Me, Read about the owners arriving tomorrow!, {attachments=[EOE604]}]) [7.667 seconds]
[19-05-15 10:40:39:991 MDT] Execution succeeded [8.575 seconds total runtime]

```