title: Gmail to Spreadsheet [GAS]
body: <p>【Error】
  Exception: The parameters (String,number,number,number) don't match the method signature for SpreadsheetApp.Spreadsheet.getRange.
  searchContactMail   @ コード.gs:24</p>
  <p>【Code】</p>
  <pre><code>    function searchContactMail() {
   
    const query = '&quot;no-reply@hojokin-osusume.com &quot;';
    const start = 0;
    const max = 10;
   
    const threads = GmailApp.search(query, start, max);
    const messagesForThreads = GmailApp.getMessagesForThreads(threads);
   
    const values = [];
    for(const messages of messagesForThreads){
      const message = messages[0];
      const record = [
        message.getDate(),
        message.getFrom(),
        message.getSubject(),
        message.getPlainBody().slice(0,200)
      ];
      values.push(record);
    }
   
    if(values.length &gt; 0){
      sheet = SpreadsheetApp.openById(&quot;1gs1FPCNtTeBfsG-euGXyTXIxlNh0f0PTeixV595BWjo&quot;)
      sheet.getRange(2, 1, values.length, values[0].length).setValues(values);
    } 
  }
  </code></pre>