How do I convert an HTML table to csv format?

2019-04-02 06:01发布

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

标签: html csv parsing
3条回答
冷血范
2楼-- · 2019-04-02 06:21

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

查看更多
手持菜刀,她持情操
3楼-- · 2019-04-02 06:32

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

查看更多
贼婆χ
4楼-- · 2019-04-02 06:45

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.

查看更多
登录 后发表回答