JavaScript SSV To HTML Convertor

This script converts Tab Separated Values (TSV), Comma Separated Values (CSV), or similar String Separated Values (SSV) into a HyperText Markup Language (HTML) table.

You must ensure that there are no examples of separators inside quoted strings within the data.  Blank cells are appended where rows are missing data.  Columns and rows are numbered from 1.

You can specify the separator character, string, or regular expression.  Default is a \t, \x09, <TAB>, <Ctrl-I> character.  You can use JavaScript regular expressions (but do not include the bounding forward slashes), or escapes to specify unprintable characters, although sometimes you may need to double-escape some characters, for example if \Character doesn't work, try \\Character.

Optionally, <thead>, <tfoot>, and <tbody> tags can be inserted.  In this case, the data is expected to begin with single header row, from which the table header row is created, and end with single footer row, from which the table footer row is created.

The optional column headers list is a comma separated list of column numbers to be given a <th> rather than a <td> tag.

The optional row headers list is a comma separated list of row numbers to be given a <th> rather than a <td> tag.

The optional column exclusions list is a comma separated list of column numbers which are to be omitted from the output.

The optional row exclusions list is a comma separated list of row numbers which are to be omitted from the output.

By default a caption,"Created by: <This URL>, <Date>", will be added to the table.  This can be edited, or omitted altogether by blanking it.

By default a comment,"Created by: <This URL>, <Date>", will be added to the HTML source.  This can be edited, or omitted altogether by blanking it.

To see and check the table layout more easily, you can optionally add border styling to the demonstration table.  Neither this styling nor any other is included in the HTML output.

To use this online version, paste your SSV data into the input, set the parameters, click Submit, and select and copy the resulting HTML output.   As this script is still under development, there is as yet no console version available for download.

 

 

 

 

 

 

 

   

 

 

 

Styling for the demonstration table borders (optional) …
Table Border
 
 
Cell Borders
 
 

 

 

HTML Table Output:

 

Demonstration Output Table:
 

 

Updated Description
13/06/2010 v1.1  -  Safer Array for() loops if the Array.prototype is altered.
09/12/2009 Created v1.