Sunday, October 5, 2008

Copy the Data from One Sheet to Another Sheet

'''Let assume we have a excel file called abc.xls in C drive.
'''In abc.xls we have one sheet with some values.
'''We need to copy first sheet values into second sheet

datatable.Import("c:\abc.xls")
Set src=datatable.GetSheet(1) 'Source Sheet
Set dsc=datatable.GetSheet(2) 'Destination Sheet

pc=src.getparametercount 'Get the Source sheet column count
rc=src.getrowcount 'Get the Source sheet row count

For i=1 to pc
n=src.getparameter(i).name ' Get the Source sheet column name
'msgbox n
Set pmg=src.getparameter(n)
Set pm=dsc.addparameter(n,"")

For j=1 to rc
pm.valuebyrow(j)=pmg.valuebyrow(j)
next
Next

No comments:

Post a Comment