wefwgeweg
wefwgeweg

Reputation: 1429

How do I convert an HTML table to csv format?

Is there an HTML parser or some library that automatically converts HTML tables into CSV data rows?

Upvotes: 2

Views: 39644

Answers (3)

M.S.
M.S.

Reputation: 11

you can try this simple PHP script (also as online converter) http://www.scherello.de/?id=243

Upvotes: 1

Rohit Galgalikar
Rohit Galgalikar

Reputation: 19

sed s/'<td>'//g d1.txt | sed s/'<\/td>'//g | sed s/'<\/a>'/'<\/a>,'/g | sed s/'<\/em>'/'<\/em>,'/g | sed s/'<tr>'/'<br>'/g | sed s/'<\/tr>'//g | sed s/'<th>'/'<b>'/g | sed s/'<\/th>'/'| <\/b>'/g> names1.html

Upvotes: 1

deklin
deklin

Reputation: 258

Here is some perl script. And online converter (java needed). Or you can just manually copy HTML table from browser to OpenOffice Calc / MS Excel and save it as CSV - this will work too.

And here you are step-by-step solution on PHP.

Upvotes: 2

Related Questions