cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
isavedalex
Frequent Visitor

Creating a flow to save CSV version of SharePoint list AND delimit multip person objects into new rows

Hi everyone,

 

I'm really struggling to build this flow and could use some advice. 

 

I have a Sharepoint list that shows sales territories & the assigned rep. The Sale rep column is setup as a Person/Group object, and there can sometimes be multiple sales reps assigned to a single territory.

 

Sharepoint List Setup

Sales TerritorySales Rep
UKRep 1; Rep 2; Rep 3
GermanyRep 4
CanadaRep 5

 

What I would ideally like to do, is to create a flow that spits out a CSV file each time a change is made to the list, but the CSV file must be delimited to show 1 rep per row with a repeated sales territory name.

 

Example Output

Sales TerritorySales Rep
UKRep 1
UKRep 2
UKRep 3
GermanyRep 4
CanadaRep 5

 

I have a flow built already to look for modifications and pull the display name from the person/group object, but the output is that it shows reps 1, 2 & 3 on a single row. 

 

Any help would be greatly appreciated!

1 ACCEPTED SOLUTION

Accepted Solutions
ekarim2020
Super User
Super User

Here is one solution that doesn't use any expressions:

 

Based on this sample SharePoint List:

2021-11-10_20-21-29.png

 

(1) Get Items action and initialize an array variable:

2021-11-10_20-23-23.png

 

(2) Loop through each Territory, then loop through each Sales Rep:

2021-11-10_20-23-43.png

 

2021-11-10_20-35-55.png

Create a CSV table and save to OneDrive

2021-11-10_20-23-59.png

 

This is the output:

2021-11-10_20-40-50.png2021-11-10_20-42-05.png

Hope this helps.

 

Ellis
____________________________________
If I have answered your question, please mark the post as Solved.
If you like my response, please give it a Thumbs Up.

 

View solution in original post

7 REPLIES 7
ekarim2020
Super User
Super User

Here is one solution that doesn't use any expressions:

 

Based on this sample SharePoint List:

2021-11-10_20-21-29.png

 

(1) Get Items action and initialize an array variable:

2021-11-10_20-23-23.png

 

(2) Loop through each Territory, then loop through each Sales Rep:

2021-11-10_20-23-43.png

 

2021-11-10_20-35-55.png

Create a CSV table and save to OneDrive

2021-11-10_20-23-59.png

 

This is the output:

2021-11-10_20-40-50.png2021-11-10_20-42-05.png

Hope this helps.

 

Ellis
____________________________________
If I have answered your question, please mark the post as Solved.
If you like my response, please give it a Thumbs Up.

 

AIMEN_promero
Frequent Visitor

This would be my choice too, very nicely explained!!  Lovely.

 

I have a similar problem but I want to reverse the grouping. I mean; imagine in the original table there is a rep who is listed in various territories, as well as multiple reps in certain territories. I would like to make a table with the territories covered by every individual rep, with possibly multiple territories for some of them.

 

I made it with several nested loops and conditions, but I feel that there is a much more elegant way to do it. Can you suggest a way?

If you can post some sample data and an example of the output you are expecting that will help. What is the expected ize of your data set (eg. <1000 rows?).

 

Manipulating the data in Excel or using Power BI may be the better options for the end consumer of the data?

 

Ellis

Ellis! thank you, this is exactly what I needed.

 

Thanks

I have a similar query but based on the territory filed I want to create separate spreadsheet for each. Is it possible?

Hi @Indrajit_paun ,

 

It will be best it you create a new forum post for your problems/issue. Please clearly explain the issue, along with any screenshots of the flow you are working on, and please sample data if possible.  That way should you get a  response to your specific issue from Community members.

 

Kind regards,

 

Ellis

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

MPA Licensing.jpg

Ask your licensing questions at the Power Automate AMA!

Join Priya Kodukula and the licensing team, super users and MVPs to find answers to your questions on Power Automate licensing.

Users online (1,894)