1

I would like to replace all data in a table in the existing ppt slide (not just one cell). I know what my shape id is and I found a solution (Python Pptx - Modify Existing Table) that solves for replacement of 1 cell in a table:
Presentation('yourpowerpoint.pptx').slides[0].shapes[6].table.cell(0,0).text= 'Pina Colada'

However, I have two additional questions related to replacing data in a table: 1) How can I replace all data of the table at once instead of one cell at a time?
2) When I replace data in a cell, I noticed that size of the font, centering, and color of the font change. How can I keep the font as it is in the exiting ppt table and only replace values?

Sveta
  • 161
  • 1
  • 2
  • 11
  • What data do you want to put into the table? Doesn't it have different values for each cell? What benefit are you expecting from avoiding cell-by-cell updates? – scanny Nov 06 '19 at 01:30
  • Thank you for your comment and question. I was planning to insert data from a DataFrame. On the second thought, cell by cell update is not too difficult because it is possible to write a loop for it. Please ignore my question if there is no direct way to insert Dataframe values into ppt table. – Sveta Nov 07 '19 at 00:07
  • @Sveta - Did you manage to solve this problem? I also face a similar issue where replacement is successful but font size, centering etc is all changed. Is this something that you would be able to help me with ? https://stackoverflow.com/questions/73202432/python-pptx-access-table-cell-properties-and-apply-it-back-during-replace – The Great Aug 02 '22 at 07:22

0 Answers0