al-codaio / events-from-gmail

Create Google Calendar events from sending yourself a Gmail on a mobile device using Google Apps Script.
11 stars 2 forks source link

Multiline Description #4

Closed bonelifer closed 2 years ago

bonelifer commented 2 years ago

It would be nice to have multi-line descriptions. I often create doctors appointments with the Address +number, due to the fact I have to use a free disability transport and I need that info on hand when I make a pickup appointment with them. I can only make these pickup appointments 12 days in advanced(some of my appointments are more than a month out), so it would be nice to still have all that info in the description as I have been doing it manually.

bonelifer commented 2 years ago

Someone on Reddit r/GoogleAppsScript came up with a solution, it gets every line that has text and spits it out with a linebreak. It doesn't keep empty lines, but I can live with that.(original redditor noticed my comment here and addressed it) It completely replaces the function, parseMessage. I leave this here for anyone that needs it.

function parseMessage(lines) {
  if (lines[0].toLowerCase().indexOf('cc:') != -1) {
    var guests = lines[0].substring(3, lines[0].length)
    var joinDescription = [];
    for (var i = 1; i < lines.length; i++){
  joinDescription.push(lines[i]);
  var description = joinDescription.join("\n");
}

  } else {
    var guests = '';
    var joinDescription = [];
    for (var i = 0; i < lines.length; i++){
  joinDescription.push(lines[i]);
  var description = joinDescription.join("\n");
}
  }
  return [guests, description];
}
BigJazzz commented 1 year ago

Thanks for this. I was having the same issue myself.