Export CSV to HTML

Overview

Comma-delimited file (CSV file) is a very common and important file format in data interchange between diverse applications. Converting a CSV file to an HTML table is required when the CSV file needs to be viewed in a browser. Many applications including Microsoft Excel do support options for exporting a CSV file to HTML format, though such options tend to be limited in power and flexibility.

Ferrite, on the other hand, excels at tasks such as these especially when transformations need to applied to the data before or after exporting it:

  • Replace headers or footers with more relevant text formatted differently.
  • Remove a range of records, perhaps not relevant to the output.
  • Prevent one or more columns from being output, maybe because they contain sensitive data.
  • Transform data in one or more columns such as cloaking credit card numbers.
  • Highlight data on one or more columns or rows depending on the column value itself, such as marking negative values in red.
  • Repeat the export to HTML frequently. Useful if you have data feeds that are updated often.

Create Workflow

Create a new workflow by selecting Create -> CSV Processor. Pick the project where the workflow is to be created, select the CSV file to be loaded, and click Finish. The workflow is loaded in the workflow editor, and the menu bar updated to show the filters that can be applied.

Add Filter to convert to HTML

Select Convert -> Rows/Columns to XML from the main menu, and enter the parameters as shown: table for the document element, tr for the row element and td for the column element.

Execute to create a HTML Table

Click the Run button to execute the workflow. The generated HTML table should appear within the Console area.

Remove the XML header

Notice the output carefully in the above screenshot, and you will see the XML header (<?xml ..?>), which is required in XML files. To get rid of this header, apply the filter: Find/Replace -> Pattern within line. Enter the following regular expression shown to delete the XML header.
<\?xml[^?]+\?>

Click the Execute button once again to view the output. The XML header has been deleted.

Add Page Title

To add a title to the page along with the required HTML headers, select Add -> Header from the main menu, and enter the header text as shown. The filter for adding the header should be the last filter in the workflow. If it gets added elsewhere (because the cursor was not placed at the last item), use the filter movement buttons to the right of the workflow editor to move the "Add Header" filter to the bottom.

Click execute to run the workflow, and notice that the headers have appeared as specified.

Add Footer

To complete the output as a webpage, click Add -> Footer from the main menu, and enter the footer text as shown.

Click run again to view the output with the footer added.

The output can now be saved by selecting Output -> Save As from the main menu.









































Ferrite Platform
version 1.5
US$49
90-day money back guarantee
Free Upgrades for 1 year!

Ferrite Platform
version 1.2
Free Download
Try it risk-free for 14 days