python - win32com Excel PasteSpecial -
python - win32com Excel PasteSpecial -
i'm having problem pastespecial in python. here's sample code:
import win32com.client win32com win32com.client import constants xl = win32com.gencache.ensuredispatch('excel.application') xl.visible = true wb = xl.workbooks.add () sheet1 = wb.sheets("sheet1") # fill in summy formulas in range(10): sheet1.cells(i+1,1).value = "=10*"+str(i+1) sheet1.range("a1:a16").copy() sheet1.range("c1").select() sheet1.pastespecial(paste=constants.xlpastevalues)
i'm getting next error:
typeerror: paste() got unexpected keyword argument 'paste'
i know paste keyword argument because of msdn here: http://msdn.microsoft.com/en-us/library/office/ff839476(v=office.15).aspx
any thought why won't allow me this? can't find much on web.
edit solution(s):
import win32com.client win32com win32com.client import constants xl = win32com.gencache.ensuredispatch('excel.application') xl.visible = true wb = xl.workbooks.add () sheet1 = wb.sheets("sheet1") # fill in summy formulas in range(10): sheet1.cells(i+1,1).value = "=10*"+str(i+1) sheet1.range("a1:a16").copy() sheet1.range("c1").pastespecial(paste=constants.xlpastevalues) # or found right after posted works well: xl.selection.pastespecial(paste=constants.xlpastevalues)
i don't work python pastespecial
in excel-vba, have mention cell want perform pastespecial, seek like
sheet1.range("c1").pastespecial(paste=constants.xlpastevalues)
if want simple paste guess should work
sheet1.paste
python excel excel-vba win32com
Comments
Post a Comment