Copy Datatable Content

How to copy a datatable content from globalsheet to localsheet (action1)?

Questions by naglaxmi

Showing Answers 1 - 15 of 15 Answers

You can use the ExportSheet property of the DataTable.

The syntax is as follows :


DataTable.ExportSheet "<Path of the Local excel sheet>" ,"<Global Sheet name>".

For ex:

I have added data to the Datatable in the sheet with the name 'Sheet_001' and then exported that into a local sheet.

DataTable.AddSheet ("Sheet_001").AddParameter  "OrderNumber", ORN
DataTable.ExportSheet "D:OrderDetails.xls" ,"Sheet_001".

  Was this answer useful?  Yes

qtpdeepak

  • Aug 31st, 2009
 

If the User wants to Copy all the Data from all the Rows to a Column in a Separate Sheet. Then the following code will be helpful.

A= DataTable.GetRowCount

DataTable.GetSheet(dtLocalSheet).AddParameter "CopiedData",""

For i=1 to A
 DataTable.SetCurrentRow(i)
 b=DataTable.Value("Values")
 DataTable.Value("CopiedData",dtLocalSheet)=b
Next

  Was this answer useful?  Yes

swapna.raut

  • Dec 11th, 2009
 

At runtime you can coopy the data from Global sheet to Loca Sheet(Action1) in following sequence:-

1) Export the data of Global sheet to some temporary excel (for eg C:Test1.xls)
DataTable.ExportSheet("C:Test1.xls","Global")

2) Import the data of this temp excel to Action1 datatable as
DataTable.ImportSheet("C:Test1.xls","Global","Action1")

This code is not tested,  but it should work this way.

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions