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 / Create Excel files for...
Power Automate
Answered

Create Excel files for different Teachers and send them an e-mail showing their Students

(0) ShareShare
ReportReport
Posted on by 2
Hi. I have an Excel spreadsheet listing teacher´s names, teacher´s e-mails, student´s names, courses, beginning dates and end dates.
 
What I want is for Automate to read the Excel file and create an e-mail for each teacher with an attached spreadhsheet listing all of the columns in the original spreadsheet, but just with the courses that teacher gives. The message is: Hey, teacher xxxx, attached are your students and courses next month.
 
Can somebody help? For now, if you can fill your own e-mail in the "Teacher e-mail column" for test purposes...
 
Thanks,
Categories:
I have the same question (0)
  • Verified answer
    DJ_Jamba Profile Picture
    2,837 Moderator on at
    Make sure you format the data in the Excel as a Table.
    Make sure the excel file is in your one drive or a Sharepoint library

    Flow steps:
     
    1. Location field is the One drive or Sharepoint location of your excel file

    2. Select action
    Using the following as the input:
     
    @{outputs('List_rows_present_in_a_table')?['body/value']}
    switch mapping to text mode and map fields as follows:
    {
      "Course": @{item()?['Course']},
      "Beginning Date": @{item()?['Beginning Date']},
      "End Date": @{item()?['End Date']},
      "Teacher": @{item()?['Teacher']},
      "Teacher E-mail": @{item()?['Teacher E-mail']},
      "Student": @{item()?['Student']}
    }
     
    3. Another select action.
     
    Same input as above.
    Switch mapping to text mode and enter this:
    concat(item()?['Teacher E-mail'],'|',item()?['Teacher'])

    4. Use compose to build a distinct list of techers


    With this as input:
    union(body('Teachers'), body('Teachers'))
     
    5. Apply to each using the compose above as the input
     
    Inside the apply to each:
    a) Filter array:

    The From field is the first select you created in Step 2
    Switch filter to advanced mode and enter this:
    @equals(item()?['Teacher E-mail'], first(split(items('Loop_over_teachers'), '|')))

    b) Create CSV table
     
    The From field is the body property from the filter array above


    c) Send an email
     

    You can copy all the field codes below straight into the associated field

    To field:
    @{first(split(items('Loop_over_teachers'),'|'))}

    Body field:
    Hey @{last(split(items('Loop_over_teachers'),'|'))},
    
    Attached are your students and courses next month.
    
    (Email would go to: @{first(split(items('Loop_over_teachers'),'|'))})
     
    Attachments Name:
    @{last(split(items('Loop_over_teachers'),'|'))}.csv
     
    Attachments Content:
    @body('Create_CSV_table')
     
     
    Test it...
  • Building with Why Profile Picture
    351 Moderator on at
    I have a couple of videos which work this concept out. 
     
    DJ Jamba looks correct, but if you want to see a demo of those steps check out my videos.
     
    https://youtu.be/ZJdCZYd_uco I am working with Excel sending emails to parents but the principles can be applied to going to the teachers.
     

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!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 484

#2
Valantis Profile Picture

Valantis 477

#3
Haque Profile Picture

Haque 456

Last 30 days Overall leaderboard