A
A
anton5412021-10-26 19:50:43
Python
anton541, 2021-10-26 19:50:43

How to copy a python docx table?

Good evening. Interested in the question: how to copy a table from a sheet to another sheet?
I have ex.dox file. It has 1 sheet and there is a table (in the entire sheet).
You need to create a new one (or just paste it in the last sheet, as it should be transferred to the new sheet automatically), which is an absolute copy of the first one.
Here is the code, instead of "..." should be something, probably.

import docx
from docx.shared import Pt
import os.path

document = docx.Document('ex.docx')
document.add_page_break()
...
document.save('ex2.docx')

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
anton541, 2021-10-26
@anton541

Found a solution!
https://stackoverflow.com/questions/48713465/pytho...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question