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

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,892 Super User 2026 Season 1 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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
trice602 Profile Picture

trice602 239 Super User 2026 Season 1

#2
David_MA Profile Picture

David_MA 177 Super User 2026 Season 1

#3
Kalathiya Profile Picture

Kalathiya 97 Super User 2026 Season 1

Last 30 days Overall leaderboard