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

Create CSV Table or Create HTML from SharePoint list, Person columns are JSON objects

I want to build a flow that gets a list in SharePoint Online and generates a CSV file in a library.

 

It uses these actions: Create CSV Table and Select.

 

When viewing the results, the Text type columns from the list appear correctly, but the Person columns are treated as JSON objects and I have to figure out how to convert them to string / text.

 

There is a place in the Select action for adding an Expression, but I do not know which one will work.  Any ideas?

 

If you need screen shots to visualize, use this tutorial on creating CSV that I am following.

1 ACCEPTED SOLUTION

Accepted Solutions
grahampasmurf
Level: Powered On

Re: Create CSV Table or Create HTML from SharePoint list, Person columns are JSON objects

Wait, I spoke too soon!  I got it working using this syntax:

 

item()?['Mgr']?[0]?['DisplayName']

 

Thank you, @v-bacao-msft

View solution in original post

7 REPLIES 7
Highlighted
Community Support Team
Community Support Team

Re: Create CSV Table or Create HTML from SharePoint list, Person columns are JSON objects

Hi @grahampasmurf,

 

I am confused how you created the CSV file. Could you provide more details?

I only know how to extract the corresponding data in the list and integrate them in an HTML table or CSV table.

I did a test on my side, the field name is Person, the type is also Person, and  can only select a single user.

45.PNG

47.PNG

If it is a Person type field, then Dynamic content will automatically separate the attributes.

48.PNG

If not, you can refer to the following method:

Use "item()[ColumnName][‘propertiy’] directly to get the corresponding user's attribute value, like: item()['Person']['DisplayName']

43.PNG

Please take a try.

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
grahampasmurf
Level: Powered On

Re: Create CSV Table or Create HTML from SharePoint list, Person columns are JSON objects

I tried that and it did not work at first but I will try a few variations.

 

I will add some screen shots and more detail later.

 

Thank you.

grahampasmurf
Level: Powered On

Re: Create CSV Table or Create HTML from SharePoint list, Person columns are JSON objects

How did I create the CSV file?

 

I used the "Create file" action and sent it the Output of the "Create CSV" action.

 

Capture.PNG

 

 

grahampasmurf
Level: Powered On

Re: Create CSV Table or Create HTML from SharePoint list, Person columns are JSON objects

As for your first suggestion (that Dynamic content will automatically separate the attributes), that does work when I tested using a column that has 'Allow multiple selections' set to No.

 

The problem is that the columns that I wanted all have 'Allow multiple selections' set to Yes, and with those columns I cannot get anything to work, even using your other suggestion.  If I try something like the expression

 

item()?['Mgr']['DisplayName']

 

I get the error,

The template language expression 'item()['Mgr']['DisplayName']' cannot be evaluated because property 'DisplayName' cannot be selected. Array elements can only be selected using an integer index.

 

Maybe my solution is to change all these columns so that the setting 'Allow multiple selections' is set to No.  I will do more testing on it.

 

I also got a lot of weird results in my testing.  Sometimes there is a column that I can select but it fails, saying that the column is not available, even though it should be.  Not sure why.

grahampasmurf
Level: Powered On

Re: Create CSV Table or Create HTML from SharePoint list, Person columns are JSON objects

Wait, I spoke too soon!  I got it working using this syntax:

 

item()?['Mgr']?[0]?['DisplayName']

 

Thank you, @v-bacao-msft

View solution in original post

grahampasmurf
Level: Powered On

Re: Create CSV Table or Create HTML from SharePoint list, Person columns are JSON objects

Should I mark your reply as the Accepted Solution?  It was not the solution entirely, but it helped me get there.

Community Support Team
Community Support Team

Re: Create CSV Table or Create HTML from SharePoint list, Person columns are JSON objects

Hi @grahampasmurf,

 

You could consider marking your own post, after all, the final solution is your own.

Your situation is related to "Allow multiple selection". If you set it to Yes, the return value will be an array.

And you just entered only one Person, so you only need to get the element with index 0.

If set to No, then the method I provide should be valid.

 

Best Regards,

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

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

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

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

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 Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (5,809)