I got a lots of notes from books in docx. There are in tables ex.: Notes in docx I would like to convert them to org-mode like this enter image description here

What would be the best approach to do it ?

  • I would go with copy and paste. Commented Nov 13, 2018 at 22:29
  • but I got like 500 hundred pages :/ I will took a a lot of time.
    – slk500
    Commented Nov 13, 2018 at 23:28

2 Answers 2


One way that might not be too bad, if the tables are all structured the same way, e.g. the first column is always a first level heading (and there are no newlines in it), and the second column should always be second columns, and all notes for a book are in one row, is to extract the tables using a Python script. I would put this script at the top of an org-file, change the filename to your file and see what it outputs.

#+BEGIN_SRC ipython :results raw
from docx.api import Document

document = Document('One.docx')

for table in document.tables:
    for i, row in enumerate(table.rows):
        text = [cell.text for cell in row.cells]

        print(f'* {row.cells[0].text}')
        for subheading in row.cells[1].text.split('\n'):
            print(f'** {subheading}')

This performed reasonably on a one page docx with two tables in it for me. I just had to pip install python-docx for Python3.

The solution by @richiemorrisroe will also get you an org-file with the notes in table form, but I think it would be more challenging to write elisp code to convert those into headings than the little python script above.

  • Awesome! Works great! I'm very gratefull for you help and this solution :D
    – slk500
    Commented Nov 16, 2018 at 9:35

The best way to convert docx to org-mode (in general, not just for tables) is to use pandoc (https://pandoc.org/).

You can do this: pandoc -f docx -t org inputfile.docx -o output.org

  • I think you mean docx to org-mode. I tried this on a docx file containing a simple table and was surprised at how well it turned those tables into org tables. That seems like a good start towards this goal, but there will still be a lot of processing to do to convert the tables to headlines. Commented Nov 14, 2018 at 23:48
  • @JohnKitchin I do, thank you!. I normally just write a keyboard macro to find any tables and make a name, then export to csv (which was the use-case I had). Commented Nov 17, 2018 at 18:02
  • I have a docx plenty of tables, and the result waas awesome, thanks for this suggestion
    – anquegi
    Commented Oct 23, 2021 at 7:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.