web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Building a flow to exp...
Power Automate
Unanswered

Building a flow to export a SharePoint List to CSV and send emails - Issue - JSON present the CSV due to multiple choice items.

(0) ShareShare
ReportReport
Posted on by 51

Hello.

 

I am brand new to Power Automate and am having trouble generating CSV file content from SharePoint lists where fields contain multiple choices; or the names of people selected from Active Directory.  The resulting file contains JSON in each column instead of the multiple choice text items separated by commas.  How do I solve this issue?


See below drawing.

 

Thank you in advance,

 

-Eric

 

The general idea is to build:

SharePoint List Export and Email Concept.png

Categories:
I have the same question (0)
  • v-duann-msft Profile Picture
    on at
    Re: Building a flow to export a SharePoint List to CSV and send emails - Issue - JSON present the CSV due to multiple choice items.

    Hi @ericshufro 

     

    Thank you for posting.

     

    According to your description, you would like to export SharePoint list to csv file. But currently failed due to multi-select column existing. If any misunderstanding, please kindly let me know.

     

    If that’s the case, we need to use variable to append each selection into a string to achieve your purpose.

     

    I created a list only contains few columns for your reference. I enabled multi-select feature for people and system choice column as below.

    v-duann-msft_0-1620793482087.png

     

    Flow overview:

    v-duann-msft_1-1620793482095.png

     

    Flow in detail:

    v-duann-msft_2-1620793482098.png

     

    In 'apply to each 2'

    v-duann-msft_3-1620793482101.png

     

    Add ‘update item’ action to save people display names as string into a text column.

    v-duann-msft_4-1620793482105.png

     

    Use ‘get items 2’ to retrieve updated list. 

    Expression(Only works for multi-choice column): xpath(xml(json(concat('{"root":{"choices":', item()?['SupportSystem'] , '}}'))), '/root/choices/Value/text()')

    v-duann-msft_5-1620793482110.png

     

    After running the flow, I’m able to generate CSV as below:

    v-duann-msft_6-1620793482112.png

     

    Updated list:

    v-duann-msft_7-1620793482114.png

     

    New CSV file:

    v-duann-msft_8-1620793482115.png

     

    Hope the content above may help you.

     

    Best regards,

    Anna

  • ericshufro Profile Picture
    51 on at
    Re: Building a flow to export a SharePoint List to CSV and send emails - Issue - JSON present the CSV due to multiple choice items.

    This is very helpful.  Some of the data returned by getitems includes multi-line text fields.  These fields contain HTML along with the provided text in the list.  How can i strip off the HTML so that it is not included in the csv?  Thanks, -Eric

  • ericshufro Profile Picture
    51 on at
    Re: Building a flow to export a SharePoint List to CSV and send emails - Issue - JSON present the CSV due to multiple choice items.

    Additionally, how do i 'update' the file if it already exists.  Using Create File will fail if the file exists.  I would like to update it to a new version instead of first deleting it (which invalidates past links) and recreating it.  Thanks, -Eric

  • ericshufro Profile Picture
    51 on at
    Re: Building a flow to export a SharePoint List to CSV and send emails - Issue - JSON present the CSV due to multiple choice items.

    Instead of writing back the comma delimited people picker display names to a List field (as shown above), can we instead write it to an array variable?  I have been trying all day with limited success.  Please try creating a people column, populating it with several entries, and then using an array to populate the comma delimited display names in to the csv?  Thanks. -e

  • v-duann-msft Profile Picture
    on at
    Re: Building a flow to export a SharePoint List to CSV and send emails - Issue - JSON present the CSV due to multiple choice items.

    Hi @ericshufro 

     

    Thank you for update.

     

    1.How do i 'update' the file if it already exists

    Actually, the first four columns are the main menu. The last 'peopleupdated' text column is additional column which is used to temp store persons' display name as string. So, from your end, I believe you can manually create one more column which functions as the same.

    v-duann-msft_0-1620894150294.png

     

    2.Can we instead write it to an array variable?

    This is my original idea too. But while testing, I encountered duplicate issue and can't figure it out. After many attempts, I finally determine to use current method instead.

     

    How can i strip off the HTML so that it is not included in the csv?

    For this part, I'm still testing and if it's feasible, I will post the solution asap.

     

    Thank you very much for reading my content. Hope it helps. 😀

     

    Best regards,

    Anna

  • ericshufro Profile Picture
    51 on at
    Re: Building a flow to export a SharePoint List to CSV and send emails - Issue - JSON present the CSV due to multiple choice items.

    Thanks for the reply Anna.

     

    When i said update, i meant replace the file in SharePoint.  At the moment, if the file exists in SharePoint, an error will occur.  Locally, I am deleting the file and then creating the file.  I would rather create a new version, 'update' the file in SharePoint.

     

    I removed the HTML by disabling rich text for the multi-line and single line text fields.  Couldn't figure out a better way and it was easy since rich text wasnt required.

     

    One challenge with updating the content of the List to store the DisplayName(s) is that there are other 'required' fields that must also be updated.  For the choice fields, one cannot select from dynamic content; at least the current value of the form is not suggested and therefore updating the record with the display names isnt yet plausible.

     

    On my end, I have a list of suppliers and I would like to customize the email send to each supplier.  I could do this as a CSV for each (stored in memory, not written to SharePoint), or as an HTML table in each email.  

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 462 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 456 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard