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 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 :)
答案 0 :(得分:0)
您可以尝试使用pandas lib- https://pandas.pydata.org/ 导入库-
将熊猫作为pd导入
data_frame = pd.read_excel(“ myBook.xlsm”)
pandas有很多有用的方法。 https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_excel.html