win32com

Formatting Image in Excel using win32com.client

余生颓废 提交于 2020-01-06 14:43:29
问题 I am creating an excel spreadsheet using pythons win32com module excel client. I wanted to add a logo to my excel spreadsheet report. So far I have managed to add the picture: # Set a variable to an empty excel instance excel = win32com.client.Dispatch("Excel.Application") # Initialize a workbook within excel book = excel.Workbooks.Add() # Create sheet in book sheet = book.Worksheets(1) sheet.Pictures().Insert(r"G:\logos\Logo.jpg") I've been pouring through the web and I cannot seem to find a

Formatting Image in Excel using win32com.client

只谈情不闲聊 提交于 2020-01-06 14:43:18
问题 I am creating an excel spreadsheet using pythons win32com module excel client. I wanted to add a logo to my excel spreadsheet report. So far I have managed to add the picture: # Set a variable to an empty excel instance excel = win32com.client.Dispatch("Excel.Application") # Initialize a workbook within excel book = excel.Workbooks.Add() # Create sheet in book sheet = book.Worksheets(1) sheet.Pictures().Insert(r"G:\logos\Logo.jpg") I've been pouring through the web and I cannot seem to find a

win32com.client self terminating issue

北战南征 提交于 2020-01-06 10:56:12
问题 I am using Python 3.3.5 and trying to save an Excel 2003 file (.xls) as Excel 2007 file (.xlsx). The problem with the following scripts is that the script is working very well if I run it inside of Spyder, however if I try to run it simply double-clicking on script, it does not working. Spyder can import win32com.client with no problem and run the script successfully while IDLE can not run the script and gives that error: "import win32api, sys, os " "ImportError: DLL load failed: The

win32com.client self terminating issue

别说谁变了你拦得住时间么 提交于 2020-01-06 10:56:07
问题 I am using Python 3.3.5 and trying to save an Excel 2003 file (.xls) as Excel 2007 file (.xlsx). The problem with the following scripts is that the script is working very well if I run it inside of Spyder, however if I try to run it simply double-clicking on script, it does not working. Spyder can import win32com.client with no problem and run the script successfully while IDLE can not run the script and gives that error: "import win32api, sys, os " "ImportError: DLL load failed: The

Python win32com method for word-wrap in Excel?

喜你入骨 提交于 2020-01-06 08:42:03
问题 I need to write a function that will word wrap the contents of all sheets of an active Excel workbook. I have everything written except the necessary method. I am not able to find it anywhere. Does anyone have any knowledge on this? from win32com.client import Dispatch excel = Dispatch('Excel.Application') def main(): WordWrapColumns() def WordWrapColumns(): excel.ActiveWorkbook.Save() filename = excel.ActiveWorkbook.FullName wb = excel.Workbooks.Open(filename) #Activate all sheets active

dynamically read and/or overwrite an excel file with python without the overwrite alert appearing

天涯浪子 提交于 2020-01-05 06:22:09
问题 For some reason the following code runs fine but the file overwrite alert keeps coming up even though I have set xl.EnableEvents = False, the code won't execute further unless I manually click the overwrite file popup. Does anyone know how to fix this? The code opens an excel file which contains a string which allows the excel file to connect to the bloomberg api, I used this solution here to get this to work. As long as the file is open for enough time the data is pulled into the file and

changing axis labels in excel 2007 charts using python win32com

和自甴很熟 提交于 2020-01-05 05:02:46
问题 I have an excel sheet with some data in first two columns. I created a simple chart with this data. I am facing problem in adding axis labels to the chart. here is my script from win32com.client import Dispatch, constants excel = win32com.client.Dispatch('Excel.Application') wb = excel.Workbooks.Open( 'output_data.xls', False, True) excel.Visible = False ws1 = wb.Worksheets('sheet_1) ch = ws1.Shapes.AddChart( 73, 200, 50, 800, 500).Select() excel.ActiveChart.ApplyLayout(1) excel.ActiveChart

automating excel with win32com on linux with wine

前提是你 提交于 2020-01-05 02:30:45
问题 I have a rather complex Excel 2010 file that I automate using python and win32com. For this I run windows in virtual box on an ubuntu machine. However, that same excel file solves/runs fine on Ubuntu Maverick directly using wine 1.3. Any hope of automating Excel on wine so I can drop the VM? Or is that just crazy talk (which I suspect). 回答1: You'd need a Windows version of Python, not a Linux version -- I'm saying you'd have to run Python under wine as well. Have you tried with just a normal

automating excel with win32com on linux with wine

回眸只為那壹抹淺笑 提交于 2020-01-05 02:30:09
问题 I have a rather complex Excel 2010 file that I automate using python and win32com. For this I run windows in virtual box on an ubuntu machine. However, that same excel file solves/runs fine on Ubuntu Maverick directly using wine 1.3. Any hope of automating Excel on wine so I can drop the VM? Or is that just crazy talk (which I suspect). 回答1: You'd need a Windows version of Python, not a Linux version -- I'm saying you'd have to run Python under wine as well. Have you tried with just a normal

win32com (python) error

扶醉桌前 提交于 2020-01-04 11:02:06
问题 i am trying to automate a action in notepad for a program im working on and i cant figure out an error message i am getting. import os import win32com object = win32com.client.Dispatch("Notepad.Application") error Traceback (most recent call last): File "", line 1, in File "C:\Python27\lib\site-packages\win32com\client__init__.py", line 95, in Dispatch dispatch, userName = dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx) File "C:\Python27\lib\site-packages\win32com\client\dynamic