none
How to load different files into single tables

    Question

  • Hi,

    I have a folder with 5 .CSv files and 5 Excels files,these files i want load into single table

    is it possible to load using one data flow task

    please provide a suggestions 

    Regards

    Mallis

    Friday, April 25, 2014 12:34 PM

Answers

  • you need an excel source to connect to excel files and flat file source to connect to csv file. So what you can do is to create two data flows within forEachLoop one for csv and the other for the excel.

    Have a script task before them to determine type or file (csv/xls/xslx) inside the loop. Based on that set a variable (@FileType) with relevant values (Excel/CSV). Connect the script task output to both data flow tasks. Set precedence constraint as expression and constraint option. Set constraint to OnSuccess and expression as

    @FileType == "Excel"

     for excel DFT and

    @FileType == "CSV"

     for CSV DFT


    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

    • Marked as answer by Malli123 Monday, April 28, 2014 7:23 AM
    Saturday, April 26, 2014 5:14 AM

All replies

  • Yes, if the files are only different by name.

    Use the ForEach Loop with a file enumerator.

    The loop collects the file name on each iteration and sends it to a Data Flow Task that load the file.


    Arthur My Blog

    Friday, April 25, 2014 8:44 PM
  • Thanks for u r reply

    in DFT what is the connection string i need to take ,

    if i take flat file connection ,then i can't load excel files rgt ?

    then how i have to load those files using single DFT

    Regards

    Malli

    Saturday, April 26, 2014 1:27 AM
  • you need an excel source to connect to excel files and flat file source to connect to csv file. So what you can do is to create two data flows within forEachLoop one for csv and the other for the excel.

    Have a script task before them to determine type or file (csv/xls/xslx) inside the loop. Based on that set a variable (@FileType) with relevant values (Excel/CSV). Connect the script task output to both data flow tasks. Set precedence constraint as expression and constraint option. Set constraint to OnSuccess and expression as

    @FileType == "Excel"

     for excel DFT and

    @FileType == "CSV"

     for CSV DFT


    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

    • Marked as answer by Malli123 Monday, April 28, 2014 7:23 AM
    Saturday, April 26, 2014 5:14 AM