Recently, I attempted to create a script that would email the details of all upcoming arrivals for both today and tomorrow in a single message. However, my script ended up sending separate emails for each booking detail, regardless of whether it matched the conditional expressions for today or tomorrow.
As a novice in scripting with Google Apps Script, I tried searching for solutions to combine and filter array values for emailing but didn't find a clear path forward.
Instead of the current setup, I aim to (1) check if the date matches today's and/or tomorrow's dates, then (2) gather all relevant booking details, and finally (3) sort them into today-arrivals and tomorrow-arrivals sections within a single email message.
Below is the source code I have been working on:
/* Sending notifications on upcoming arrivals for today and tomorrow. */
function NotifyUpcomingArrivals() {
// Code implementation
}
I am seeking guidance on how to modify this code to achieve the desired outcome. Any help through code examples or recommended readings would be greatly appreciated by the community.
Update 1: After incorporating some minor adjustments based on suggestions, the script now functions flawlessly. Thank you for the assistance!