Use the Table Converter page to convert tab-delimited text to HTML tables. If you have data in a spreadsheet that you want to publish in HTML, this tool can help.
Tab-delimited text can be created many ways. One common method is to select a block of cells in a spreadsheet and use the Edit > Copy command or press Ctrl+C. The text placed on the clipboard will be in tab-delimited format. You can also save a spreadsheet to a text file and choose tab-delimited text as the output file format. Using the clipboard is usually more convenient than creating a text file. If the text is already in a text file because it was created that way or you saved it there from a spreadsheet, you can put the text on the clipboard by opening the text file in a text editor such as Notepad, selecting all the text using Ctrl-A and then copying it using Ctrl+C.
Once you have the text on the clipboard, click in the large text area in the Input section above and press Ctrl-V to paste the text into the text area. Click the [Convert to HTML Table] button to convert the input text to an HTML table. The HTML table version of the text will be placed in the text area in the Generated HTML area. The HTML will also be added to the current page in the Preview section.
If you enter a Class name, the script will generate CSS statements you can use as a starting point to style the table. If you omit the Class name, the script will not generate the CSS statements and the preview of the table will use the browser defaults. See the CSS section below for more details.
If First row is column headers is checked, the script will treat the first row of values as column headers. A column header row is styled separately from the data rows.
If Remove unnecessary quotes is checked, the script will remove " characters that it deems unnecessary. For example, in some tab-delimited text, the " character is used to enclose cell values that include special characters, and each occurrence of a " in the original cell values is converted to "". The script will convert "" back to ". Also, if a cell value includes a comma, some software will add quotes around the entire cell value. If a cell value begins and ends with ", and the cell value also contains one of the following special characters, the script will remove the outer quotes. The special characters are:
' " ,
If you enter a number in the ID Column, the script will display additional options for special treatment associated with the ID column. Columns in the input text are numbered starting at one.
If Show ID Column is checked, the ID column will be included in the table. If Show ID Column is unchecked, the ID column will be omitted from the table. If your text data includes an ID number of some kind, and you do not want the ID in the table, enter the column number and uncheck Show ID Column.
If the table will be used with Second Site, you can use the ID column feature to create links from rows in the table to people on the site. Enter the ID column number, which will usually be column 1, and then enter a column number in the Link column(s) text box. (To specify multiple columns, separate the link column numbers with commas.) The value in the ID column must be a TMG ID number. The value in the link column(s) will be converted into a link to the person page entry for the person with the given TMG ID. The link will use a Second Site script statement, so you must add the generated HTML to a Custom Page and then make the site for the links to work properly.
This script generates CSS in two formats, (1) standard CSS format and (2) the Free Form User Style format used in the Stylesheets section of Second Site. Which format you use depends partly on how many tables you create and partly on your own preferences for handing CSS.
- If you are not using Second Site, then you should copy the standard CSS text into a stylesheet used by the page where you paste the HTML.
- If you are using Second Site and you have only a single table, then you should probably use this method: Copy the standard CSS text into the Page Options > Head Tags property of the Custom Page where you place the HTML for the table. Add a <style> tag before the CSS text, and a </style> tag after it. To alter the style of the table to suit your preferences, adjust the CSS after you add it to the Page Options > Head Tags property.
- If you are using Second Site and you have multiple tables, then you should probably use this method: Copy the Free Form User Styles text into one of the Free Form User Styles sections. See the help page for the copy/paste commands for instructions. Any styles added in the Free Form User Styles section will apply to all data tables that share the same class name.
After you copy the CSS once, you typically will not have to copy it again even if you regenerate the HTML table. The script on this page does not modify the CSS based on the data you provide other than to use the class name you specify.
My table converter was inspired by similar tools by Bob Greiner and Steve Morse.
This page last changed on 03 Feb 2016.