cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
thejack0fhearts
Level: Powered On

Create a separate .csv attachment for each row in the original Excel file

Hey, guys - I've got a funky use case here. I'm trying to set up a flow to take the data from each row in a spreadsheet and send an email with that data but also include a .CSV with just the data from that row as an attachment (we're trying to eFax this data, and the eFax solution calls for an attachment).

 

How would you go about filtering down the rows for each record and creating a .CSV attachment?

 

Here's what I've got so far:

flow.png

 

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Create a separate .csv attachment for each row in the original Excel file

Hi @thejack0fhearts,

 

Do you want to send an email for each row in your spreadsheet?

 

If you want to send an email for each row in your spreadsheet, please take a try with the following workaround:

  • Add a proper trigger, here I use Flow Button trigger.
  • Add a "Get rows" action.
  • Add a "Apply to each", Input parameter set to output of "Get rows" action. Within "Apply to each", add a "Create CSV table" action, From field set to following formula:
array(item())

Add a "Send an email" action, Attachments Name field set to EachRow.csv and Attachments Content field set to output of "Create CSV table" action.

 

Image reference:6.JPG

The flow works successfully as below:7.JPG

 

8.JPG

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Community Support Team
Community Support Team

Re: Create a separate .csv attachment for each row in the original Excel file

Hi @thejack0fhearts,

 

Do you want to send an email for each row in your spreadsheet?

 

If you want to send an email for each row in your spreadsheet, please take a try with the following workaround:

  • Add a proper trigger, here I use Flow Button trigger.
  • Add a "Get rows" action.
  • Add a "Apply to each", Input parameter set to output of "Get rows" action. Within "Apply to each", add a "Create CSV table" action, From field set to following formula:
array(item())

Add a "Send an email" action, Attachments Name field set to EachRow.csv and Attachments Content field set to output of "Create CSV table" action.

 

Image reference:6.JPG

The flow works successfully as below:7.JPG

 

8.JPG

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Highlighted
thejack0fhearts
Level: Powered On

Re: Create a separate .csv attachment for each row in the original Excel file

Kris,

Brilliant stuff! It's working great. Thanks!

However, now that I see the output, there are two challenges:

 

First, the eFax picks up the default column widths of the CSV (which don't wrap), so most of the cells are hidden behind longer values. My workaround is to insert "spacer" headers with no value in the "Create CSV Table" step, but I'm curious if there is a more elegant way to format the column widths of the CSV.

 

Second, I'm now realizing how many emails will be generated from each row - is it possible to "group" the rows inserted into each CSV/email by a certain value?

 

Thanks for your help!

 

 

thejack0fhearts
Level: Powered On

Re: Create a separate .csv attachment for each row in the original Excel file

So, I've found a workaround for the formatting issue - I made an HTML table instead and attached it as a .doc, which wraps the text well enough for the faxing application to read it.

 

I'm still stumped about how to group rows with the same ID (name) into one table, so each name only gets one email sent, instead of sending one email per row (which would result in multiple emails to users with multiple rows).

 

Any help would be greatly appreciated, @v-xida-msft.

 

Thanks!

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Watch the event on demand for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 Release Wave 2 Plan

Power Platform 2019 Release Wave 2 Plan

Features releasing from October 2019 through March 2020.

thirdimage

Flow Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Flow Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 4 members 3,439 guests
Please welcome our newest community members: