Python – Write Values in all Worksheets of existing Excel File

Working with VBA is usually not considered high level of programming. Still, when it comes to Excel, this is probably the best solution. However, Python has some libraries which can help a bit, if you are willing to “mimic” the VBA capabilities.

In this article I present a code snippet, that writes some simple maths calculations in all the sheets of an existing Excel file.

The three nested loops do the following – the first one loops the “worksheets collection” of the existing worksheets of the workbook “newFile.xlsx”. The second and the third one loop through rows and columns and write values in the Excel file. The saving of the workbook is a must.

Small and easy. Still, it works.

Tagged with: , ,