I need your help please, I want to automize my everyday tasks with python code. I need to open an existing excel document, modify some information in it(ex: date) then save it as pdf and print it. Is it possible to do all these via python? I have tried to do this with openpyxl, I can open and modify the sheets, but' I can't save as pdf only one sheet of the workbook and print it then.
Asked
Active
Viewed 475 times
1
-
This might help you.[enter link description here](https://stackoverflow.com/questions/20854840/xlsx-and-xlslatest-versions-to-pdf-using-python) – saikumar kolisetty Jan 18 '19 at 11:17
2 Answers
0
Try using xlwings, it allows you to use more or less any Excel feature because it's actually opening the file and working on it (you can decide if that's done in the background or you can actually see it).

micric
- 621
- 4
- 15
-1
Why you need to use Python? I think easiest way is write macro in VBA excel (which can updating values in your sheet) and than print it out as PDF or .

Ambroży
- 75
- 5
-
Just I' am learnin actually Python and I like this language very much I know that everything is possible vie Python just a question of right code, and also I don't know VBA and it seemed to me it is impossible to write a so complex macro in it, isn't it? – Ben17 Jan 18 '19 at 11:26
-
You may write a macro solving much more complex problems than saving to PDF. But referring to VBA there is a lot of examples step-by-step showing how to write excel to pdf file i VBA excel. e.g. [demo1](https://www.contextures.com/excelvbapdf.html) or [demo2](https://powerspreadsheets.com/save-excel-file-pdf-vba/) – Ambroży Jan 18 '19 at 14:37
-
Yes, I had a look a little to Macros, I think I should better createmacros then execute them with python it will be great, thank you – Ben17 Jan 18 '19 at 15:17