如何将 HTML 表格转换为 CSV? [英] How can I convert an HTML table to CSV?

查看:39
本文介绍了如何将 HTML 表格转换为 CSV?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将 HTML 表格 (

) 的内容转换为 CSV 格式?是否有一个库或 linux 程序可以做到这一点?这类似于在 Internet Explorer 中复制表格,然后将它们粘贴到 Excel 中.

How do I convert the contents of an HTML table (<table>) to CSV format? Is there a library or linux program that does this? This is similar to copy tables in Internet Explorer, and pasting them into Excel.

推荐答案

这个方法不是真正的库或程序,但对于临时转换你可以

This method is not really a library OR a program, but for ad hoc conversions you can

  • 将表格的 HTML 放入名为 something.xls
  • 文本 文件中
  • 用电子表格打开它
  • 将其另存为 CSV.

我知道这适用于 Excel,而且我相信我已经使用 OpenOffice 电子表格做到了.

I know this works with Excel, and I believe I've done it with the OpenOffice spreadsheet.

但您可能更喜欢 Perl 或 Ruby 脚本...

But you probably would prefer a Perl or Ruby script...

这篇关于如何将 HTML 表格转换为 CSV?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆