On Wednesday, 4 June 2014 10:28:28 UTC+5:30, Ian wrote:
> On Tue, Jun 3, 2014 at 9:55 PM, Jaydeep Patil <[email protected]> wrote:
>
> > Hi lan,
>
> >
>
> > For plotting one graph, I need to use four to five excel files. Currently I
> > am reading excel files one by one and copy data of excel files to another
> > single master excel file. This master excel file consists of all data from
> > all input excel files. So this is the reason i am using system clipboard.
>
>
>
> I don't currently have Excel around to test with, but I think you
>
> could do something like this:
>
>
>
> wb1.Sheets(1).Range("A1:F100").Value = wb2.Sheets(1).Range("A1:F100").Value
>
>
>
> Not sure how efficient this is -- I envision it serializing an entire
>
> array of data to send over COM to Python, only to send it right back
>
> again at the other side. But then, the clipboard would be doing more
>
> or less the same thing. It might be more efficient to implement the
>
> above as a macro in Excel and then just call the macro.
Hi lan,
Below is the sample function which doing copy paste in my case.
I am copying data directly by column, not reading each & every value.
Data is too big in heavy.
def copyPaste(self,ws):
# todo
self.ws = ws
startRowPaste = self.headerRow
self.col = self.getColToPaste(ws)
rngPaste = ws.Cells( startRowPaste, self.col)
self.datafile.openDataFile()
self.datafile.ws.Activate()
rngCopy = self.datafile.ws.Cells(self.datafile.headerRow,self.colCopy)
rngCopy = self.datafile.ws.Range(rngCopy,rngCopy.End(util.Xl.xlDown))
rngCopy.Copy()
ws.Activate()
ws.Paste(Destination=rngPaste)
self.dataRange = self.getDataRange()
self.datafile.closeDataFile()
pass
--
https://mail.python.org/mailman/listinfo/python-list