Skip to main content
Power Automate
    • Connectors
    • Templates
    • Digital process automation
    • Robotic process automation
    • Business process automation
    • Process advisor
    • AI Builder
  • Pricing
  • Partners
    • Blog
    • Documentation
    • Roadmap
    • Self-paced learning
    • Webinar
    • Business process and workflow automation topics
    • Overview
    • Issues
    • Give feedback
    • Overview
    • Forums
    • Galleries
    • Submit ideas
    • User groups
    • Register
    • ·
    • Sign in
    • ·
    • Help
    Go To
    • Microsoft Power Automate Community
    • Welcome to the Community!
    • News & Announcements
    • Get Help with Power Automate
    • General Power Automate Discussion
    • Using Connectors
    • Building Flows
    • Using Flows
    • Power Automate Desktop
    • Process Advisor
    • AI Builder
    • Power Automate Mobile App
    • Translation Quality Feedback
    • Connector Development
    • Power Platform Integration - Better Together!
    • Power Platform Integrations
    • Power Platform and Dynamics 365 Integrations
    • Galleries
    • Community Connections & How-To Videos
    • Webinars and Video Gallery
    • Power Automate Cookbook
    • Events
    • 2021 MSBizAppsSummit Gallery
    • 2020 MSBizAppsSummit Gallery
    • 2019 MSBizAppsSummit Gallery
    • Community Engagement
    • Community AMA
    • Community Blog
    • Power Automate Community Blog
    • Community Support
    • Community Accounts & Registration
    • Using the Community
    • Community Feedback
    cancel
    Turn on suggestions
    Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
    Showing results for 
    Search instead for 
    Did you mean: 
    • Microsoft Power Automate Community
    • Galleries
    • Power Automate Cookbook
    • Re: CSV to HTML (with CSS applied for formatting) ...

    Re: CSV to HTML (with CSS applied for formatting) and Send it Email

    01-26-2021 07:00 AM

    Julyapp1
    Regular Visitor
    1016 Views
    LinkedIn LinkedIn Facebook Facebook Twitter Twitter
    Julyapp1
    Julyapp1
    Regular Visitor
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    CSV to HTML (with CSS applied) and Send it in email

    ‎01-26-2021 07:00 AM

    Embedding a CSV into HTML format is a tedious work unless we have options to use premium built-in connectors. 

     

    Herewith is the flow to convert a CSV into HTML format which can be further utilized to Send HTML table in email OR save it as HTML file on Gateway.

     

    Logic of converting CSV to HTML is:

    1. Get the CSV file content (can be from Onedrive, Sharepoint, on-premise Gateway etc.)
    2. Read the contents of the file into an array variable EACH_ROW by splitting the contents of CSV data
    3. Initialize variables for CSS and composing the HTML Table tags with assimilating the EACH_ROW data within CSS and HTML table tags to form HTML table. 
    4.  Process the EACH_ROW variable by,
      1. Replace '\n' value in CSV with '</tr><tr><td>'. This marks the end of each row in CSV data.
      2. Replace ',' in CSV with '</td><td>'. This marks creating columns for each cell value in CSV data.
      3. Replace '[' with '<tr><td>'. This marks the header row (1st row) of the CSV data which will be used as header in html table.
      4. Replace or remove ']' from the CSV data as this appears in trail end of CSV data and is not needed.
    5. Concatenate the CSS variable with the data obtained in step (d) of Step (4).
    6. Once the step 'd' from step 4 is obtained,
      • Send it in email with CSS applied to it (using step # 3 variables) as specified in step # 5.
      • Or embed the table as-is based on your need from Step # 4.
      • Or Save it on Gateway (on-premise gateway) accordingly.

    CSS that I am applying is - have blue background with white text to header of the table.

     

    Hope this helps! Please feel free to reach out to me in case of any queries or if more details are needed from my side. 

    Unfortunately I am not able to upload the exact flow, hopefully the screenshots and sample CSV file included in attachments helps you!

     

    If your CSV file differs from the sample, you can still leverage the logic mentioned here by applying the pattern noticed in your CSV file.

     

    Thanks!

    MS Flow and Sample CSV file.zip
    Labels:
    • Labels:
    • Automated Flows
    • Scheduled flows
    • Solutions
    Message 1 of 2
    1,017 Views
    0 Kudos
    Reply
    • All forum topics
    • Previous Topic
    • Next Topic
    Julyapp1
    Julyapp1
    Regular Visitor
    • Mark as New
    • Bookmark
    • Subscribe
    • Mute
    • Subscribe to RSS Feed
    • Permalink
    • Print
    • Report Inappropriate Content

    ‎01-26-2021 07:00 AM

    Uploading it again since the previous one somehow is not showing as uploaded 😞

    Message 2 of 2
    1,016 Views
    0 Kudos
    Reply

    Power Platform

    • Overview
    • Power BI
    • Power Apps
    • Power Pages
    • Power Automate
    • Power Virtual Agents

    • Sign up free
    • Sign in

    Browse

    • Templates
    • Connectors
    • Partners

    Downloads

    • Mobile
    • Gateway

    Learn

    • Documentation
    • Learn
    • Support
    • Community
    • Give feedback
    • Blog
    • Pricing

    • © 2023 Microsoft
    • Contact us
    • Trademarks
    • Privacy & cookies
    • Manage cookies
    • Terms of use
    • Terms & conditions
    California Consumer Privacy Act (CCPA) Opt-Out Icon Your California Privacy Choices