Home Forums SQL Server 2005 SQL Server 2005 Integration Services How to read a data from an excel file having multiple sheets and insert into multiple tables tables RE: How to read a data from an excel file having multiple sheets and insert into multiple tables tables

  • Create a package. Create a connection to the Excel file. Create an OLE DB connection for where the data is going to go. The Excel connection will contain the directory and file name. If you have five sheets then place five Data Flow Tasks on the Control flow of the package. Link the five data tasks with control flow so that they execute one after another.

    Open up the first data flow task place an Excel Source Task in the data flow and an OLE DB Destination task (if appropriate). The Excel source will allow you to connect to a specific sheet the file. Alternatively you are offered the chance to use a SQL Command. The SQL Command can be very good as it is not really SQL it just treats the sheet as if it were a table and if you select this there is a build query button. Do this all for the first sheet. If the data is not of the right format you can use a data conversion to correct it.

    Repeat the above till all five sheets are done.

    You can do this in a loop, you can store the sheet and SQL required in variables but I wanted to make it as simple as possible.

    Hope this helps.

    Ells:cool: