Coders Packet

Merge Two Docx files into a Single one in Python

By Lakshay Sharma

A package that can be used to merge two or more doc files together written purely in Python. Both code and GUI available for usage and further development.

Merge Two Docx files into a Single one in Python

A package that can be used to merge two or more doc files together.

How to use


Installing the base package

pip install python-docx

GUI ONLY :

pip install PySimpleGUI

Run 'DocxMergerGUI.py' directly.

 

Add 'DocxMerger.py' to required location where you need to merge the files

After installing the package import:

from DocxMerger import merge_docx

Then use the following commands:

merge_docx("first.docx", "second.docx")
creates a docx file named 'merged.docx'

merge_docx("first.docx", "second.docx", name="foo.docx")
creates a docx file named 'foo.docx'

Replace "first.docx""second.docx" with the locations of two files you need to merge

OR

Copy the code from the file as it is,
import the required files and use the full power of docxcompose library

 

Running Example


Original Word Files:

First.docx

First.docx

Second.docx

Second.docx

Code Example

Code

Merged Word File

Merged file

 

GUI 

GUI with code bg

GUI

NOTE: File will be saved when you close the application!

Download Complete Code

Comments

No comments yet

Download Packet

Reviews Report

Submitted by Lakshay Sharma (LakshaySharma)

Download packets of source code on Coders Packet