Thursday 24 January 2019

Load only first 10 records from the excel into the database table

I am getting an excel sheet in this sheet there is n number of records but our requirement is to load only first 10 records from this excel sheet.
In this demo, we will see how to load only first 10 records from the excel.
I am using below excel file which has 1000 records.

I am taking a Data flow task.
   
In Data flow, I am taking Source as excel
   
Creating an excel connection.
  
Click ok. Select Data access mode as SQL Command.

Now we need to write the SQL query to pull the data from excel sheet.
  
Select * from [1000 Records$A1:AK11]
Click on the Preview button in review window we will see only 10 records.
If we want to read the whole sheet then we can write SQL query as below
Select * from [1000 Records$]
But we want to get the data from the specified range so we will provide the range.
Click ok.
Now I am taking destination as OLEDB and doing the mapping.
  
Before running this package records in the database.
  
Now running this package.

See only 10 records are loaded.
Let’s see the records in the database.



Get the expected result.

No comments:

Post a Comment

If you have any doubt, please let me know.

Popular Posts