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.
Solved! Go to Solution.
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.
If it is a Person type field, then Dynamic content will automatically separate the attributes.
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']
Please take a try.
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.
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
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.
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.
Fill out a quick form to claim your user group badge now!
We've given our badges an overhaul and also added some brand new ones!
Learn how to build the business apps that you need.
Find out where you can attend!
Watch & learn from the Power Automate Community Video Gallery!