Excel to clean and minimal html

K

KiwiBrian

Is there a program that will convert an excel file to a clean html table
without the extra formatting crud that excel includes.
I just want the raw data in a minimal html table so that I can add my own
CSS to style it.
 
C

Chris F.A. Johnson

Is there a program that will convert an excel file to a clean html table
without the extra formatting crud that excel includes.
I just want the raw data in a minimal html table so that I can add my own
CSS to style it.

Save the table as a CSV (comma-separated values) file and run it
through a script such as this:

echo "<table>"
awk -F, '{
print "<tr>"
n = 0
while ( ++n <= NF ) printf " <td>%s</td>\n", $n
print "</tr>"
}
'
echo "</table>"
 
D

dorayme

"Chris F.A. Johnson said:
Save the table as a CSV (comma-separated values) file and run it
through a script such as this:

echo "<table>"
awk -F, '{
print "<tr>"
n = 0
while ( ++n <= NF ) printf " <td>%s</td>\n", $n
print "</tr>"
}
'
echo "</table>"

I have used similar and it works very well indeed. Recommended. It is
also very good in that maintenance is minimal if you are being supplied
big tables that need updated from a client. Ask them to supply in CSV
format.
 
K

KiwiBrian

dorayme said:
I have used similar and it works very well indeed. Recommended. It is
also very good in that maintenance is minimal if you are being supplied
big tables that need updated from a client. Ask them to supply in CSV
format.

Thanks chaps.
Are you able to pont me to a page that describes the
methodology/implentation of running such a "script"?
 
J

Jonathan N. Little

KiwiBrian said:
Is there a program that will convert an excel file to a clean html table
without the extra formatting crud that excel includes.
I just want the raw data in a minimal html table so that I can add my own
CSS to style it.
Using a simple text editor like metapad where you can search on carriage
returns and tabs it can be simply done. Or you can do it in Word.

Select the cells in Excel and past as text.

The pasted contents is tab delimited.

for metapad 2 S&R operations.

Search: \n Replace: </td></tr>\n<tr><td>
Search: \t Replace: </td><td>

Start with: <table>
End with: </table>

Done.
 
C

Chris F.A. Johnson

Thanks chaps.
Are you able to pont me to a page that describes the
methodology/implentation of running such a "script"?

It runs in a UNIX shell.

With a slight modification, it can be run with just the AWK
programming langauge:

awk -F, '
BEGIN { print "<table>" }
{
print "<tr>"
n = 0
while ( ++n <= NF ) printf " <td>%s</td>\n", $n
print "</tr>"
}
END { print "</table>" }
'
 
K

KiwiBrian

Thanks very much Ed.
Looks like the best solution so far.
Will try using your method in conjunction with Dreamweaver.
 
D

dorayme

"KiwiBrian said:
Thanks chaps.
Are you able to pont me to a page that describes the
methodology/implentation of running such a "script"?

Ed's suggestion is perhaps best for you. I endorsed Chris's because I
use it for more complicated situations. One of these situations is where
it helps that the client can bypass me and not attracts fees (it being a
non-profit organization and me being a savage money grabbing no holds
barred profiteering usuring Cagney type out for anything that I can get
a claw on...). Most clients are up to Excel but not to good HTML.

But if you ever have the need, this is how I do I. I put in the php
script in the html at the point at which I want the table to appear. I
then simply load up the html to the server along with csv file. In the
script is a reference to this separate csv file and the php engine on
the server does the business.

If you want an example of the html file and a url of the result, you can
email me.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,023
Latest member
websitedesig25

Latest Threads

Top