web blazonry web development scripts and tutorials Get best price on Unlocked International Phone w/Triple Cameras
   PHP       Name Generators       Perl       CSS       Javascript       Java       MySql       How Tos       Resources   

Perl Home

Perl Scripts
  Count Links
  Mail to MySQL
  ProcLog Files
  Search and Replace
  Site Monitor
  UnTabify

Perl Articles
  csv2htm Converter
  OLE Automation
  Regular Expressions
  SubDir Recursion

Perl Resources
  Regular Expressions Quick Reference
  Regular Expressions Examples
  Recommended Sites
  Bestselling Perl Books
  Free Perl Books (new)
  Free Python Books(new)

Bookmark and Share




Perl : csv2htm

csv2htm converts a comma-delimited text file into an HTML file. It is a fairly simple script which can create a simple HTML table out of Excel exported csv files. The script can easily be modified to convert tab delimited or any delimited rows of data to an HTML table.

All the script does is simply read in each line of the input file, prepends <TR><TD> to the line, converts all delimiters to </TD><TD> and appends </TD></TR> at the end of the line. This puts each value in between delimiters in its own table cell and each line in its own row.

The first line is processed a little differently under the assumption that the row contains your column headings these are given <TH> tags and a light grey background color.

The power of Perl, this script was written in less 20 minutes and I think it works better than Excel's HTML output feature. it doesn't include any of the bullshit formatting such as fonts, weird style sheet adding and other useless junk that Excel puts in there.

Usage: perl csv2htm.pl <infile.csv> <outfile.html>

Download Script: csv2htm_pl.txt

 

Related Links:

RTF to HTML Converter (Shareware)

txt2html - Text to HTML Converter (Perl Script)

W3.org - HTML Converters (List of Tools)

 

Newest Pages
Test Google Ads Ver. 2
Free Linux Admin Books
Free Linux Books for Programmers
Free Books for Linux on the Desktop
Free PHP Books
Free JavaScript Books
Free Java Books - Advanced
Free Java Books - Basic
Free Perl Books
Free Python Books
Quote of the Day (PHP)
Debugging Part 2
How to Test Google Ads
Most Popular Pages
Baby Name Generator
U.S. Name Generator
Wu Name Generator
Popup Windows (JavaScript)
Upload and Resize an Image (PHP)
How To Install Apache + PHP + MySQL
Intro to Web Databases (PHP, MySQL)

Least Popular Pages
iNews Applet (Java)
Java Resources
Site Monitor (Perl)
PHP Resources
 
 

  privacy policy     ||     © 1997-2016. astonishinc.com   All Rights Reserved.