web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Conditionally assemble...
Power Automate
Unanswered

Conditionally assemble and send emails from Excel with Office Scripts

(1) ShareShare
ReportReport
Posted on by 21

In a single Office 365 Excel workbook, there are three sheets.

 

The first sheet "People" contains data about the recipients, including their names, emails and categories.

email-sheet.png

 

The second sheet has lookups, which link category with code.

lookup.png

 

And the final sheet has text of email to be sent.

text.png

 

What I would like to do using Power Automate/Office Scripts is to send emails only to people for whom the category is either 2 or 3. Emails should NOT be sent to those with category 1.

The mail merge bit is to:

  1. Append appropriate code for the recipient in the subject grabbed from Sheet3!A2. e.g. For Mack, the code would be GNG.
  2. Prepend "Dear recipient name" in the email body grabbed from Sheet3!B2. For Mack, this would be "Dear Mack,"
  3. To send emails to the correct email addresses. For Mack it should be sent to mack@company.com

I have even struggled to find any tutorials on how to use Office Scripts to send emails in Excel. So would greatly appreciate any guidance.

Categories:
I have the same question (0)
  • trice602 Profile Picture
    15,404 Super User 2025 Season 2 on at

    Hi @VPundir ,

     

    Here's how I would approach this.  For starters, I wouldn't over-complicate this with three separate tables, what you are doing can be collapsed into a single table, shown below.  I didn't include the first name in my example.

     

    trice602_0-1700579999471.png

     

    Here's the flow.  Note above, if you never intend to email category 1, simply don't include it or filter it out.  In my example, I didn't include.  

     

    trice602_1-1700580059398.png

     

    So here, I list all the non-category 1 rows in a table and then loop through each row and send an email.  For me it is much easier to simply collapse the email distro into a semicolon separated email list in a column.

     

    That said, you have enough framework here to help you get started!

     

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard