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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / .htm to .csv file conv...
Power Automate
Answered

.htm to .csv file conversion

(0) ShareShare
ReportReport
Posted on by 20

Hello all,

 

I receive a weekly email containing an attachment which is in a .htm format, and I'd like to convert this into a .csv or .xlsx file with Power Automate, does anyone know how I can go about this?

 

Thanks!

Categories:
  • NiloferA Profile Picture
    on at

    Hello @Arslan123 ,

    Perhaps the below post can help you gain some insights.

    https://powerusers.microsoft.com/t5/Power-Automate-Cookbook/HTML-Table-to-CSV-or-Pipe-delimited-text-file/m-p/766703#M274

    In case if you have any further queries, I would be happy to answer them!

    Please give a Kudo if you found this helpful or Mark this Reply as Solution if it solved your problem.

  • powercorner Profile Picture
    477 on at

    Hello @Arslan123 ,

     

    making a html to a csv does not sound possible. Is there any table inside the htm file?

    If so you could first store the html text inside a variable and then use the "split" Expression to get the values out of the html. Maybe you could send us an example html file so we could help you a little bit with the splitting logic.

     

    With regards

    Kevin

  • Arslan123 Profile Picture
    20 on at

    Hi @NiloferA , thanks for your reply! I can't seem to see the individual steps properly, and I don't have access to Power Automate Desktop. Would you be able to share each step in the flow in that article please if possible?

  • Arslan123 Profile Picture
    20 on at

    Hi @powercorner , thanks for your reply! I am unable to attach a .htm file here unfortunately, but have taken a screenshot of a sample one below, hope that helps. There are 3 grey tables at the top, but I am looking to extract the orange table in particular into a csv file. 

     

    Arslan123_0-1621798275637.png

     

  • powercorner Profile Picture
    477 on at

    In the link of @NiloferA there is a zip. You can just import the file to your Power Automate Platform.

  • Verified answer
    powercorner Profile Picture
    477 on at

    Okay I try to make an example.

    Lets assume your html looks like this:

     

    <!DOCTYPE html>
    <html>
    <body>
    <h2>HTML Tables</h2>

    <table id="myTable">
    <tr>
    <th>Company</th>
    <th>Contact</th>
    <th>Country</th>
    </tr>
    <tr>
    <td>Alfreds Futterkiste</td>
    <td>Maria Anders</td>
    <td>Germany</td>
    </tr>
    <tr>
    <td>Centro comercial Moctezuma</td>
    <td>Francisco Chang</td>
    <td>Mexico</td>
    </tr>

    </table>

    <table id="anotherTable">
    <tr>
    <th>Company</th>
    <th>Contact</th>
    <th>Country</th>
    </tr>
    <tr>
    <td>Ernst Handel</td>
    <td>Roland Mendel</td>
    <td>Austria</td>
    </tr>
    <tr>
    <td>Island Trading</td>
    <td>Helen Bennett</td>
    <td>UK</td>
    </tr>

    </table>


    </body>
    </html>

     

    Then I start splitting the information out of the html like that:

     

    First I split out my tables ID and I know that my result is on the "right side" of my splitted string. So in the next compose I use the output of the previous compose (but the [1] array field).

    Then I split the table finish tag out. And I know that all my info is inside my new array field [0].

    So I split out the tablerows (<tr>) next. 

     

    Now you have an array with each "csv line"

    you just need to replace the <tr> and <th> tags with semicolons (";") for each row.

    And then write back the info line by line into a variable or whatever. 

    Then you can use the variable as content of a excel file. 

     

    powercorner_0-1621801312186.png

     

    I hope you understand this approach.


    With regards,

    Kevin

     

     

  • Arslan123 Profile Picture
    20 on at

    Thanks @powercorner , I am receiving the .htm file in an email attachment, but i'm struggling to get the flow to open and read the attachment content as HTML in a similar way you have shown above. Instead my output is a Base64 string. Please could you help with this?

     

    Arslan123_1-1622209912805.png

     

  • powercorner Profile Picture
    477 on at

    Hello @Arslan123 ,

     

    of course I can help you. (Kudoe and Solution welcome!)

     

    If you have a base64 string you can easily compose it like this:

    powercorner_0-1622304502451.pngpowercorner_1-1622304540006.png

    This is the expression I use:

    base64ToString(outputs('Get_file_content')?['body']?['$content'])

    and this compose makes my html readable:

    powercorner_2-1622304623783.png

     

     

    With regards

    Kevin

  • Arslan123 Profile Picture
    20 on at

    Thanks @powercorner this worked great!

    I have used the approach used here to extract the table I need from the .htm file: HTML Table to CSV or Pipe delimited text file - Power Platform Community (microsoft.com)

    My table is now in a pipe-delimeted format in a compose action step. Please could you advise how I can now take this data and insert it into a new excel file (as a table)? 

    I need this to be in an excel table as I would like to set up the flow to send an email to each individual in the table, so it will go row-by-row and send an email to each individual.

     

    Thank you very much for your help so far!

  • powercorner Profile Picture
    477 on at

    hey @Arslan123,

     

    you could really like my answer at least (otherwise this will be my last answer)  😉

     

    well if you want to build an excel file you should create an template file somewhere in your sharepoint. Add one table inside the template excel file and then use this file to create your rows in the flow.  

    powercorner_0-1622740084466.png

    You can use your info from the csv file and add it row by row to the table.

    After you have done that you could move, copy, save or send the file somewhere.

    Did you mean this?


    With regards
    Kevin

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
Mohsin Ali Profile Picture

Mohsin Ali 355

#2
11manish Profile Picture

11manish 336 Super User 2026 Season 2

#3
M Bilal Khan Profile Picture

M Bilal Khan 308

Last 30 days Overall leaderboard