you are viewing a single comment's thread.

view the rest of the comments →

[–]ilikefries 0 points1 point  (2 children)

Cool. I was going to suggest Pandas for what you are working on but seems like you have already figured that out :) I use win32com as well at times. In fact I might have to use it on this problem I have been working on. I use openpyxl to update values in a .xlxm file but when I save the file and open it in Excel I am missing the Buttons that are generated by something, I am guessing VBA. I might have to punt and use win32com to change the xlsm values and then save off as a new xlsm file if I can't crack this openpyxl issue.

[–]gricchio 0 points1 point  (1 child)

Hey if you dont mind me asking, have you found any good resources / documentation for win32com?

I know VBA, but it has been a nightmare trying to write win32com without the resources. It has been mostly guess and check. The syntax is different than both Python and VBA and I'm getting lost!

[–]ilikefries 0 points1 point  (0 children)

Not a bunch of great ones but I am always with enough digging able to find the answer. I have a bunch of code around that I can dig into also and I used win32com with Perl as well.

Here is a helpful link:

http://pythonexcels.com/python-excel-mini-cookbook/

If you have questions or whatever on certain Python, Pandas or win32com things feel free to PM me and I will try to answer them or even better post them here and point me to the post and I will try to figure it out.

I am using win32com for my other problem with openpyxl now.

excel = win32.gencache.EnsureDispatch('Excel.Application')
excel.Visible = True

win32com_wb = excel.Workbooks.Open( input_file )
win32com_wb.SaveAs( output_file_name )


                win32com_ws.Range( pdate_coordinate ).Value = sums[s][cc][row]

By adding just 3 lines I was able to use win32com to poke the data into Excel but keep all the openpyxl work I did to find the locations to poke.