function getMail(){ var thds = GmailApp.getInboxThreads(); var row = 1; for(var n in thds){ var thd = thds[n]; var msgs = thd.getMessages(); for(m in msgs){ var msg = msgs[m]; var from = msg.getFrom(); var to = msg.getTo(); var date = msg.getDate(); var subject = msg.getSubject(); var body = msg.getBody(); row++; } } }