Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert Jupyter notebook into MS word document .doc?

In Jupyter Notebook, I am able to convert a notebook to pdf and HTML using nbconvert. However, there is no way to convert it into .doc(Word Document). Is there a way to convert it to MS Word keeping the same text highlights and table structure?

like image 781
HARSHA VARDHAN Avatar asked Nov 08 '18 12:11

HARSHA VARDHAN


People also ask

Can you turn a Jupyter Notebook into a PDF?

The Jupyter Notebook has an option to export the notebook to many formats. It can be accessed by clicking File -> Download as -> PDF via LaTeX (or PDF via HTML - not visible in the screenshot).


2 Answers

The simplest way to convert a jupyter notebook (.ipynb file) to word file (.docx) is using pandoc. First install pandoc, follow instruction here. Once installed, open your terminal to check if its installed correctly by using

pandoc --version

Once you are sure its installed there, use the following line of code in the terminal to convert the jupyter notebook to word file.

pandoc jupyter_file.ipynb -s -o new_word_file.docx

One word of caution, you first need to get into the directory in which your jupyter notebook is, in your command prompt. You can do that by typing the path after writing cd(change directory) in the command prompt. This code will create the word file in the same folder where the Jupyter notebook is.

Screeshot of terminal code

like image 122
Nilabh Avatar answered Oct 01 '22 14:10

Nilabh


Use this website https://alldocs.app/convert-jupyter-notebook-to-word-docx

Upload the .ipynb, it works with code, text and pictures

like image 34
Vitor Abella Avatar answered Oct 01 '22 12:10

Vitor Abella