Reputation: 11
I am trying to find an answer to my problem. I am trying to create some python code for transferring data from an excel table to a word table. e.g. The row from the excel table should be copied from excel and be pasted in a certain column in the word table. Can anyone help me with that, please? Thank you
Upvotes: 0
Views: 2028
Reputation: 633
It looks like you'll need the openpyxl and python-docx libraries.
You should then be able to read the excel file by iterating over rows, and create a word table by using table = document.add_table(rows=rows, cols=cols)
.
You can then fill in the table by using row_cells = table.add_row().cells
and row_cells[0].text = text
. I've linked the documentation for both modules above.
Upvotes: 1