6

Judging by other feats of strength I've seen from the Emacs community, there MUST be a solution out there for this, but I can't seem to find it.

What's a way within Emacs to parse an HTML table and turn it into an Emacs table, either table.el or an org-mode table? The only way I can see to do it right now is to drag a chunk of a web page into Excel, then export that to CSV or something & import into Emacs. But I don't want to rely on either a browser or Excel, I just want to do it within Emacs, or at most with a shell tool.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Ken Williams
  • 22,756
  • 10
  • 85
  • 147

1 Answers1

4

pandoc can convert html to orgmode.

Ista
  • 10,139
  • 2
  • 37
  • 38
  • That doesn't seem to be very robust - here's a snippet (extracted from my real-world example) that it punts on: http://goo.gl/nvO3u . I guess I could do some pre-processing to remove the `

    ` tags it seems to be choking on.

    – Ken Williams Mar 21 '13 at 16:32
  • Yeah @KenWilliams that is pretty bad. There is a thread at http://lists.gnu.org/archive/html/emacs-orgmode/2011-07/msg01108.html discussing some alternatives, but I have not tried them. – Ista Mar 21 '13 at 18:05
  • 1
    `pandoc --from html --to org =(pbpaste) -o -` to convert from the clipboard to org. – HappyFace Sep 16 '20 at 20:50