Home | Legal Tech | Projects | Writings


When working through a data room, it is important not to miss a document. This script reads the contents of all the folders, working down from the file where the script is placed, and generates a word document with a table for each folder in the document, and listing its files to be ticked off.


  1. Install python-docx module
  2. Run the script and check the docx file

1. Installing the module

The python module we need to install is called 'python-docx'.

If you are unsure how to install this module, check the guide at python basics.

2. Run the script

Open a terminal, navigate to the bibles folder, let's create our script named 'doccheck.py' with:

$ touch doccheck.py

I have made a dummy file structure for my data room for example purposes. Here's what it looks like when I run the tree command:

bible folder structure

The next step is to paste the below script in to doccheck.py:

Now, run the script in the usual way by entering:

$ python3 doccheck.py

Once that has run, you will see a new file named 'checklist.docx' in the bible folder. Let's open it up and take a look:

finished checklist

Looking good! See if you can figure out how to change the column titles to start making your own tables. The python-docx documentation will be a great place to start for help.