How to Create Excel file in SSIS

  • Hello All,

    I want create excel file through ssis. and generate the file name as the current month. The columns are fixed but want to create file for every month.

    Shaun...

  • You could create a connection and change in the Expressions property to change the ConnectionString Property to something like this:

    "C:\\MyPath\\"+ (DT_STR, 50, 1252) (MONTH(GETDATE()) == 1 ? "January" : MONTH(GETDATE()) == 2 ? "February" : MONTH(GETDATE()) == 3 ? "March" :

    MONTH(GETDATE()) == 4 ? "April" : MONTH(GETDATE()) == 5 ? "May" : MONTH(GETDATE()) == 6 ? "June" :

    MONTH(GETDATE()) == 7 ? "July" : MONTH(GETDATE()) == 8 ? "August" : MONTH(GETDATE()) == 9 ? "September" :

    MONTH(GETDATE()) == 10 ? "October" : MONTH(GETDATE()) == 11 ? "November" :

    MONTH(GETDATE()) == 12 ? "December" : "InvalidMonth") + ".xlsx"

    Then you just use the connection as your Data Flow destination.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • BUT HOW TO create the excel file. as i m using the excel destination but not sure how to insert the data.

  • The data flow will insert the data. If the file doesn't exist then it will create it. In fact, when the file doesn't exist, you have to define as well the definition of your Excel Sheet that will work as destination table.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2

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

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