Is there a way of using python and win32com to copy and paste such that python scripts can run in the background and not mess up the \"users\" copy and paste ability?
<
A little late, but I think I have your solution, and since I had trouble finding it it'll help someone anyway. This piece of code will copy everything (value, formula, formating, etc) without using selections (thus not messing with your users, and this is faster than using selections)
First I open excel like that :
xl = client.Dispatch("Excel.Application")
wb = xl.Workbooks.Open("c:/somepath/file.xls")
xl.Visible = 1
To copy and paste on the same worksheet while conserving formating, formulas, etc:
ws = wb.Sheets("someSheet") #you can put the sheet number instead of it's name
ws.Range('a1:k%s' % row).Copy() #copy works on all range objects (ws.Columns(), ws.Cells, etc)
ws.Paste(ws.Range('a7'))
To copy and paste on an other worksheet while conserving formating, formulas, etc:
source_ws = wb.Sheets("SheetContainingData")
destination_ws = wb.Sheets("SheetWhereItNeedsToGo")
source_ws.Range('a1:k%s' % row).Copy()
destination_ws.Paste(destination_ws.Range('a7'))
case sensitive.