![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| To Break data out of HTML | phip | Shell Programming and Scripting | 1 | 05-20-2008 03:23 AM |
| extract data from html tables | Streetrcr | UNIX for Dummies Questions & Answers | 8 | 03-20-2008 06:14 AM |
| Converting Shell Script to HTML | davwel | Shell Programming and Scripting | 3 | 10-25-2007 10:25 PM |
| Converting HTML to CSV | Jexel | UNIX for Dummies Questions & Answers | 3 | 03-18-2007 08:44 PM |
| Converting %## back to special characters from an HTML form | 98_1LE | Shell Programming and Scripting | 1 | 01-14-2006 11:30 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread |
Rating:
|
Display Modes |
|
||||
|
Converting HTML data into a spreadsheet
Hi,
I have a perl script that prints some data in the form of a table (HTML table) Now, I want to be able to convert this data into a report on an Excel sheet. How can I do this? Regards, Garric |
|
||||
|
Modding the script is probably less frustrating than parsing HTML tables.
Tab-delimited or comma-delimited should be fine for any spreadsheet. (I wouldn't be surprised if Excel and/or OOo had limited support for directly importing HTML tables these days, either.) |
|
|||||
|
if you are planning to create a fancy excel sheet, then Spreadsheet::WriteExcel will help you
|
|
||||
|
Try this awk
awk 'BEGIN{
FS="|" print "<HTML><BODY><TABLE border=1>" } { printf "<TR>" if(i=1) printf "<TD ALIGN=\"LEFT\" width=\"100\" height=\"25\"><font size=\"2\" face=\"Verdana\"><b>%s</font></b></TD>", $i if(i=2) printf "<TD ALIGN=\"LEFT\" width=\"300\" height=\"25\"><font size=\"2\" face=\"Verdana\">%s</font></TD>", $i if(i=3) printf "<TD ALIGN=\"LEFT\" width=\"80\" height=\"25\"><font size=\"2\" face=\"Verdana\">%s</font></TD>", $i if(i=4) printf "<TD ALIGN=\"LEFT\" width=\"80\" height=\"25\"><font size=\"2\" face=\"Verdana\">%s</font></TD>", $i if(i=5) printf "<TD ALIGN=\"LEFT\" width=\"80\" height=\"25\"><font size=\"2\" face=\"Verdana\">%s</font></TD>", $i if(i=6) printf "<TD ALIGN=\"LEFT\" width=\"80\" height=\"25\"><font size=\"2\" face=\"Verdana\">%s</font></TD>", $i } END{ print "</TABLE></BODY></HTML>" } ' file.txt >> file1.xls ****** i-- has number of records ******delimiter is " |" it's return XLS files and open in windows. |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Tags |
| html, perl |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|