Python – Read and Write to Excel ActiveX Textbox

Reading and writing to an Excel ActiveX textbox with Python can be fun. If you really do not have anything better to do. Anyway, if this is your current task, you are on the correct place to see how it is done.

A river in the centre of Sofia.

Imagine having two textboxes in Excel file named xl.xlsx which is present in the same directory as the python code, looking like this:

The left one is named TextBox2 and the right one is named TextBox1. Then, the idea is to print the text of the right one on the console and to be able to write some text on the left one. Long story short, the code is self-explanatory:

The code can be probably improved in a lot of ways, putting the workbooks and the texts as parameters and passing them to the functions, but this is not the idea of the article! Enjoy! 🙂

Tagged with: , , , , ,