How to read excel file in SSIS – Load into SQL Server

Introduction

ssis-excel-file-source

In this post, we will learn How to read excel file in SSIS – Load into SQL Server.  We will use SSIS PowerPack to connect Excel file. This article also covers how to read Excel file in SSIS.

SSIS Excel File Source Connector (Advanced Excel Source) can be used to read Excel files without installing any Microsoft Office Driver. You can extract using Table mode or query mode (SQL Command).

In nutshell, this post will focus on how to Read Excel file and load data into SQL Server Table.

Prerequisite

  1. First, you will need to have SSIS installed
  2. Secondly, make sure to have SSDT
  3. Make sure that Microsoft Excel installed
  4. Finally, do not forget to install ZappySys SSIS PowerPack

Components Mentioned in this article

What is Excel File Source Connector

SSIS Excel File Source Connector (Advanced Excel Source) can be used to read the Excel file without installing any Microsoft Office Driver. You can extract using Table mode or query mode (SQL Command). Support for flexible metadata detection mode so you can get accurate datatypes

Getting Started

In order to start, we will show several examples of how to connect the excel file and read data from the excel worksheet. ZappySys includes an SSIS Excel File Source Connector that will help you in reading excel sheet data from Excel File. Here we are showing you is, How to Load Excel File data in SQL Server using SSIS Pack.

Getting Started – Read Excel File in SSIS

Let´s start with an example. Let’s use our SSIS Excel File Source Connector, we will read data from Microsoft Excel File.

  1. First of All, Drag and drop Data Flow Task from SSIS Toolbox and double click it to edit.Drag and Drop SSIS Data Flow Task from SSIS Toolbox
  2. Now add Excel Source from the SSIS Toolbox.
    Drag and Drop Excel Source

    Drag and Drop Excel Source

  3. Double Click on Excel Source for edit and select New Connection and click on New button.
    ssis-edit-excel-file-source

    Edit Excel Source

  4. Now select the excel file path in and test connection in opened excel connection manager window and click on OK.
    Select Excel File For Connection

    Select Excel File For Connection

  5. Let’s read the Excel Workbook data using table mode and select sheet to read data from that excel sheet.
    ssis-excel-file-source-access-mode-table

    Load Excel Sheet Data using Access mode as a Table

  6.  We can also read Excel Workbook using SQL Query mode and filter the data.
    Read from Excel File using SQL Query Mode

    Read from Excel File using SQL Query Mode

  7. You can do various other things also in the query mode, find our various example here to read Excel Workbook using SQL Query mode.
    Read from Excel File using SQL Query Mode Examples

    Read from Excel File using SQL Query Mode Examples

     

  8.  That’s it we are ready to load excel file data to SQL Server.

Load Excel File data into SQL Server

Now let's look at how to load data into target like SQL Server, Oracle or Flat File. In below example we will see loading data into SQL Server database but steps may remain same for other targets which can be accessed using OLEDB Drivers (e.g. Oracle).
  1. Inside Data Flow, Drag and drop Upsert Destination Component from SSIS Toolbox
  2. Connect our Source component to Upsert Destination
  3. Double click Upsert Destination to configure it
  4. Select Target Connection or click NEW to create new connectionConfigure SSIS Upsert Destination Connection - Loading data (REST / SOAP / JSON / XML /CSV) into SQL Server or other target using SSIS Configure SSIS Upsert Destination Connection - Loading data (REST / SOAP / JSON / XML /CSV) into SQL Server or other target using SSIS
  5. Select Target Table or click NEW to create new table based on source columns
  6. Click on Mappings Tab to Auto map columns by name. You can change mappings as you need SSIS Upsert Destination - Columns Mappings SSIS Upsert Destination - Columns Mappings
  7. Click OK to Save Upsert Destination Settings
  8. That's it, You are now ready to run data flow. NOTE: If you wish to debug data flow and see records when you run, add data viewer by right click on blue arrow > Click Enable Data Viewer
  9. To execute data flow, Right click anywhere inside Data Flow Surface and click Execute Task
 

Conclusion

Above all, in this blog, we learned how to read excel file worksheet Data in Excel File using SSIS Pack. We used Excel File Source Connector to read the Excel file and load data into SQL Server. You can download SSIS PowerPack here to try many other scenarios not discussed in this blog along with 70+ other components.

References

Finally, you can use the following links for more information:

Posted in SSIS Excel Connection, SSIS Excel Source and tagged , , , .