Skip to main content

Notifications

Power Automate - Building Flows
Suggested answer

Controlling when an email is sent based on content of an Excel File

Posted on by 6
I am using PowerAutomate to send emails weekly to customers with a spreadsheet attached containing sales order data.  From time to time the customer does not have any live sales orders and so the spreadsheet does not contain any sales order data.  Is there any way for the email to NOT SEND if the spreadsheet contains no data? Or is there any other way of controlling when a customer email sends that does not require manually turning off the flow?
  • Suggested answer
    David_MA Profile Picture
    David_MA 7,541 on at
    Controlling when an email is sent based on content of an Excel File
    I thought your issue is you wanted to send the e-mail based on the content in an Excel file? There are no Excel actions in your flow. How does what you show relate to what you are asking? Based on the limited information of your use case, you would at a minimum need to do something like this:
     
    Even the above is making a lot of assumptions about your process. It assumes that you have one spreadsheet for the process and that the sales order data is contained in a table. If so, list the rows in the table corresponding to the customer and use a length expression to check the number of rows. Since all tables have a header row, there must be at least one row, so you want to check if there is more than one row. If there is, on the true side you would send the e-mail and on the false side do nothing or something you have not mentioned in your post. The expression in the condition to get the number of rows is: length(outputs('List_rows_present_in_a_table')?['body/value'])
     
    I cannot provide anything more than a high-level suggestion based on the information you have provided. To provide a more accurate recommendation, we need a bit more detail about your current setup. Specifically, it would be helpful to know how the spreadsheet is generated and whether there is more than one spreadsheet involved. Additionally, understanding the organization and content of the spreadsheet is crucial. For instance, where does the email address for sending the email to the customer come from? Is it included in the spreadsheet, or does it come from another source? If it’s from another source, how is the relationship between the spreadsheet and the recipient established? Any additional information about your process will help us give you a more precise and effective solution.
     
    Here are a few more questions that could help clarify the requirements for building this workflow:
    1. Data Source: How is the sales order data collected and stored before it is placed into the spreadsheet? Is it coming from a database, an API, or another source?
    2. Spreadsheet Format: Are there specific columns or headers that are always present?
    3. Trigger Conditions: Are there any specific conditions or criteria that determine when an email should be sent, aside from the presence of data in the spreadsheet?
    4. Error Handling: How should the workflow handle errors or exceptions, such as issues with data retrieval or email sending failures?
    5. Customer List: Is the list of customers static, or does it change frequently? How is this list maintained and updated?
    6. Email Content: Is the email content static, or does it need to be dynamically generated based on the data in the spreadsheet?
    7. Security and Compliance: Are there any security or compliance requirements that need to be considered, such as data encryption or privacy regulations?
    Your best bet will be to start building something and then when you encounter a specific issue, post a question specific the that issue instead of asking how to build a complete solution, which is something these forums are not designed to do.
  • LBugg Profile Picture
    LBugg 6 on at
    Controlling when an email is sent based on content of an Excel File
  • David_MA Profile Picture
    David_MA 7,541 on at
    Controlling when an email is sent based on content of an Excel File
    In Microsoft Edge you can press <Ctrl>+<Shift>+<S> to take a screen shot. Choose Area from the menu and then drag a box around your flow actions. Press copy in the toolbar and you can then paste the image into your post using <Ctrl>+<v>. 
  • LBugg Profile Picture
    LBugg 6 on at
    Controlling when an email is sent based on content of an Excel File
    Thank you David,
    I am new to PowerAutomate.  This solution sounds promising.  I have 2 sheets in the spreadsheet - one contains a pivot table and the other (hidden sheet) contains a table but there is something in the first row, the table starts on row 2.  
    How do I share my flow with you so you can check?  
     
  • David_MA Profile Picture
    David_MA 7,541 on at
    Controlling when an email is sent based on content of an Excel File
    You can use the List rows action and then use a length expression to see if there are any rows in the table. If there are more than one row, send the spreadsheet. Of course, it would be best if you show your flow so we know what you have configured as this answer may not apply.

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

November 2024 Newsletter…

November 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #7 Community Profile Tips…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 143,246

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 63,884

Leaderboard