Hi There,
To send an email to each user containing their respective item and price list as an attachment in Excel format, follow the solution below using Power Automate:
1. Retrieve data from SQL table: Use the "Get rows" action in Power Automate to retrieve the data from the SQL table. Configure the connection to the SQL database and specify the table from which you want to fetch the data.
2. Group data by user: Utilize the "Group by" action to group the retrieved rows based on the "User" column. This will allow you to process the data for each user individually.
3. Loop through each user group: Implement a "Apply to each" loop to iterate over each group of data, which represents each user's item and price list.
4. Generate Excel table for each user: Inside the loop, create an Excel table that includes the "Item" and "Price" columns for the current user's group of data. You can use the "Create table" action to define the table structure.
5. Convert Excel table to Excel file: Convert the Excel table generated in the previous step into an Excel file. Utilize the "Convert table to Excel" action to achieve this.
6. Send email with Excel attachment: Use the "Send an email" action to send an email to the current user. Configure the necessary parameters such as recipient, subject, and body of the email. Attach the Excel file generated in the previous step as an attachment to the email.
7. Complete the loop: The loop will automatically iterate through each user's group of data, generating separate Excel files and sending emails to each user individually.
By following this solution, you will be able to send an email to each user containing their item and price list as an attachment in Excel format. The process involves retrieving the data from the SQL table, grouping it by user, generating an Excel table for each user, converting it to an Excel file, and sending the email with the attachment.
Make sure to save and test your Power Automate flow to ensure it functions as expected.
Please give kudos and mark as solution if it helps.
Thanks,
Sandeep Mishra