Tuesday, April 8, 2008

How to import excel sheet data

'The import sheet method will import the datas from the source sheet to the local datasheet.

Dim First Name, Last Name, Address, Phone, Zip, City, State,DOB

Data Table.ImportSheet "C:\Test Repositaory\input data.xls","inputdata",dtLocalSheet

First Name=DataTable("First Name", dtLocalSheet)
Last Name=DataTable("Last Name", dtLocalSheet)
Address=DataTable("Address", dtLocalSheet)
Phone=DataTable("Phone", dtLocalSheet)
Zip=DataTable("Zip", dtLocalSheet)
City=DataTable("City", dtLocalSheet)
State=DataTable("State", dtLocalSheet)
DOB=DataTable("DOB", dtLocalSheet)

'Get sheet method will get the sheet and add parameter will add the column whose name is
given in column name.

DataTable.GetSheet (”input data.xls”).AddParameter “First Name”,"Last Name","Address","Phone","Zip","City","State","DOB"

No comments: