Python Forum

Full Version: Manipulating Excel with Python.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,

I am new to Py. I need to write data to, read data from, and run a few VBA macros within an excel book. Would rather the book never be opened (non-graphical), but I'll take a "remote control" approach if that's what it takes. I installed Openpyxl, https://pypi.org/project/openpyxl/#files and tried to load in the complicated xlsm book, and it complained "Data Validation Extension" is not supported. I was able to read a value from a cell anyway, but not able to write a new value into a cell. And when i saved the new book, it was half the size it should be, and excel couldn't open it due to it being "corrupt".

Is there a more robust way to do this? Maybe i just need a couple load options?

I used: wb = load_workbook(filename = 'myBook.xlsm')

Thanks in advance for any help :)
Try other libraries: http://www.python-excel.org/
Import win32com.client will allow you to write VBA within Python. Check out sigma coding Youtube channel.