Extracting Excel files from Multiple subfolders and load them into sql server table basing on city name

  • Hi,

    I have a folder which contain's Sub folders(City Names) and in those sub folders I have excel files. I have to take all the excel files from the sub folder and load them into a SQL Server table basing on the city name. The files are structured as below.

    Dallas Folder contain's these files

    DALLAS_Cars_2011.xls

    DALLAS_Trucks_2011.xls

    DALLAS_Bikes_2011.xls

    my requirement is I have to load the cars data into cars table and Trucks data into Trucks tables, basing on their names and all the city file's should go into same table like cars's, trucks.. And I have to create an ID column basing on the city name it can be based on the alphabetical order

    can any of the guys help me in this...

  • You can write a simple .net application which will read excel files, manipulate data as you want and then insert into database.

  • Can be done quite easily in SSIS.

    See attached SSIS solution which will look through a directory and pop a message up when a xls file is found. All you need to do is adapt that to do the import etc.

    My directory structure :

    D:\Cities

    D:\Cities\Dallas

    D:\Cities\Another City

    d:\Cities\Dallas\cars.xls

    d:\Citiies\Another City\cars.xls

    d:\Citiies\Another City\trucks.xls

    you could add in further checks to make sure the file name contains truck, car etc before importing.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply