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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Export SharePoint list...
Power Automate
Unanswered

Export SharePoint list to CSV and convert html columns to plain text

(0) ShareShare
ReportReport
Posted on by 1,599 Super User 2024 Season 1

Hello,

 

I have built this flow to export a SharePoint list to a CSV file whilst also converting 3 columns that have HTML formatting to plain text. The flow runs OK however only the SharePoint columns are being generated into the list but not the 'HTML to Text' columns.

As you can see from the generated file, the rows are duplicated and only showing one of the items from the SharePoint list.

This should be showing every item from the SharePoint list.

 

sudosaurus_3-1678292331451.png

 

Flow details:

 

sudosaurus_0-1678291980037.png

sudosaurus_1-1678292003237.png

sudosaurus_2-1678292102863.png

Categories:
I have the same question (0)
  • grantjenkins Profile Picture
    11,063 Moderator on at

    When you run your flow can you look at the output you get from each of the Html to text actions. Or have a look at the output in your Select to see if you're getting any data for those within there at least.

     

    Also, if possible, show a sample of your SharePoint List.

  • sudosaurus Profile Picture
    1,599 Super User 2024 Season 1 on at

    @grantjenkins 


    Here's a sample of the SharePoint list

    sudosaurus_0-1678355726038.png

    The three HTML to Text actions are converting correctly:
    As you can see it's doing one record at a time in the 'Apply to each' action. 

    But only adding one of the items in the list to the final document that is produced.

    sudosaurus_3-1678356165626.png

     

     

    Here's the 'Select' inputs and outputs:

    sudosaurus_2-1678355928013.png

     

     

     

     

  • grantjenkins Profile Picture
    11,063 Moderator on at

    @sudosaurus Sorry for the delay in getting back to you. I had a play with different fields (Hyperlink, Multiline Text [Plain Text], Multiline Text [Rich Text], etc.) and found that you only need to cater for the Rich Text fields.

     

    The way you had your flow structured; it would have created a separate file for each iteration since Create file is within your Apply to each.

     

    For this example, I'm using the following list.

    grantjenkins_0-1678585407406.png

     

    See full flow below. I'll go into each of the actions.

    grantjenkins_1-1678585517855.png

     

    Get items retrieves all the list items.

    grantjenkins_2-1678585548274.png

     

    Initialize variable creates a variable called data of type Array. This will eventually contain our objects we want to use as final output.

    grantjenkins_3-1678585600377.png

     

    Apply to each iterates over each of the items retrieved.

    grantjenkins_4-1678585641018.png

     

    Html to text HTML and Html to text HTMLV2 remove the HTML formatting from our two Rich Text columns.

    grantjenkins_5-1678585694044.png

     

    Append to array variable builds up an object with the fields we want in our CSV table and appends it to the data variable.

    {
     "Company": @{items('Apply_to_each')?['Title']},
     "Account Manager": @{items('Apply_to_each')?['AccountManager']},
     "URL": @{items('Apply_to_each')?['URL']},
     "HTML": @{body('Html_to_text_HTML')},
     "HTMLV2": @{body('Html_to_text_HTMLV2')}
    }

    grantjenkins_6-1678588186200.png

     

    After the Apply to each we use Create CSV table using the data array as input.

    grantjenkins_7-1678588234167.png

     

    Create file uses the output from Create CSV table to create our CSV file.

    grantjenkins_8-1678588271838.png

     

    After running the flow I'd get the following CSV file. I had to resize the rows/columns to see all the data.

    grantjenkins_9-1678588397998.png


    ----------------------------------------------------------------------
    If I've answered your question, please mark the post as Solved.
    If you like my response, please consider giving it a Thumbs Up.

  • sudosaurus Profile Picture
    1,599 Super User 2024 Season 1 on at

    @grantjenkins this looks superb!

    I’ll be trying this tomorrow at work! 🙂

  • sudosaurus Profile Picture
    1,599 Super User 2024 Season 1 on at

    @grantjenkins this solution works great.

     

    I have one last question, which from my tinkering is proving a nightmare to acheieve.

     

    I also need to save the list item attachments into a folder - DONE, but also want to reference the attachment names in the list CSV file - any idea on how I could achieve this?

     

    Thanks!

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 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard