Skip to main content

Notifications

Community site session details

Community site session details

Session Id : bJRFKLqgAk9RcRLG6o2RFT
Power Automate - General Discussion
Answered

Birthday Email - Random values from Excel

Like (0) ShareShare
ReportReport
Posted on 18 Mar 2024 08:23:09 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:
  • zbeg Profile Picture
    295 Super User 2025 Season 1 on 19 Mar 2024 at 08:29:41
    Re: Birthday Email - Random values from Excel

    Your welcome 

    Have a good one 🙂

  • Kingfisher1 Profile Picture
    78 on 19 Mar 2024 at 08:22:47
    Re: Birthday Email - Random values from Excel

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

  • Verified answer
    zbeg Profile Picture
    295 Super User 2025 Season 1 on 19 Mar 2024 at 08:12:52
    Re: Birthday Email - Random values from Excel

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

  • Verified answer
    Kingfisher1 Profile Picture
    78 on 19 Mar 2024 at 08:05:58
    Re: Birthday Email - Random values from Excel

    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
    zbeg Profile Picture
    295 Super User 2025 Season 1 on 19 Mar 2024 at 07:52:52
    Re: Birthday Email - Random values from Excel

    hi,

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

  • Kingfisher1 Profile Picture
    78 on 19 Mar 2024 at 07:49:43
    Re: Birthday Email - Random values from Excel

    What could be the schema for parse Json

  • zbeg Profile Picture
    295 Super User 2025 Season 1 on 19 Mar 2024 at 07:29:30
    Re: Birthday Email - Random values from Excel

    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 18 Mar 2024 at 13:32:46
    Re: Birthday Email - Random values from Excel

    Please find attached, flow.

     

    Kingfisher1_0-1710768747047.png

     

  • zbeg Profile Picture
    295 Super User 2025 Season 1 on 18 Mar 2024 at 09:03:57
    Re: Birthday Email - Random values from Excel

    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?

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,660 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,004 Most Valuable Professional

Leaderboard