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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Birthday Email - Rando...
Power Automate
Answered

Birthday Email - Random values from Excel

(0) ShareShare
ReportReport
Posted on by 78

I was creating a birthday automated email.  2 sheets in online Excel.  one with employee name and DOB, second with birthday quotes in each cells.

 

Flow created as to check today's date and DOB in excel.  If matches, then pick a birthday quote from 2nd sheet of excel and send an email to the employee.

 

Now that sending email is working, but instead of sending one quote, flow sends all quotes in seperate email.   Eg, if there are 30 quotes, flow sends 30 emails with each quote in each email.

 

my problem is it should pick only one random quote per match instance

Categories:
I have the same question (0)
  • arcado Profile Picture
    352 Moderator on at

    Hi

    add a step that selects a random quote from the second sheet.

    Use a function or action that generates a random number , rand() within the range of the total number of quotes.Retrieve the quote corresponding to the randomly generated index.

     

    If it is not working caan you show your flow?

  • Kingfisher1 Profile Picture
    78 on at

    Please find attached, flow.

     

    Kingfisher1_0-1710768747047.png

     

  • arcado Profile Picture
    352 Moderator on at

    hi,

     

    It seems like the problem is in your second apply to each. iin your way you are sending email for each birthday sentence. 

     

    I  created an excel with this values,

    excel19.png

    and my flow is like this

    automate19.png

    what I do here is , list rows in excel is present in your flow.

    You need to create a compose function like,

    body('List_rows_present_in_a_table')?['value'][rand(1,length(body('List_rows_present_in_a_table')?['value']))]

    It will give you an item in between your sentences.

    and you need to get a parse json activity to only select the sentence. 

    Try test your flow, you will get an output from your compose copy and paste in your parse json generate from sample,

    You will get a sentence variable you can put it in email.

     

    If you need any further questions you can ask

    Have a great one 🙂

     

     

  • Kingfisher1 Profile Picture
    78 on at

    What could be the schema for parse Json

  • Verified answer
    arcado Profile Picture
    352 Moderator on at

    hi,

    test your flow without parse Json get the outputs from compose action. copy and paste it 

  • Verified answer
    Kingfisher1 Profile Picture
    78 on at

    it sends email, picks only one sentence.  But sends multiple emails with same details.  I have 30 birthday quotes.  It sends 30 emails.  Earlier each mail had different quotes, now same quote sent 30 times

  • Verified answer
    arcado Profile Picture
    352 Moderator on at

    delete apply to each 2 part only do actions I send.

  • Kingfisher1 Profile Picture
    78 on at

    That worked ! Thank you so much.  understand when looping occurs, first to check 'apply to each' 😊

  • arcado Profile Picture
    352 Moderator on at

    Your welcome 

    Have a good one 🙂

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Valantis Profile Picture

Valantis 474

#2
11manish Profile Picture

11manish 268

#3
David_MA Profile Picture

David_MA 243 Super User 2026 Season 1

Last 30 days Overall leaderboard