Importing to Excel from SQL Server using SSIS

  • Hello,

    Here's what I am trying to do in my SSIS package:

    I would like to export data from a SQL Server query to an excel spreadsheet on a monthly bassis with a specific name and previous months date.

    For example when the package is run I would like the package to output the excel file in this format:

    seeds_2013_1.xls

    So far i have:

    I have created an OLE DB Source with path to data conversion and a path to an Excel Destination.

    My Excel Connection manager currently has the a path to: C:\folder\

    Please could you explain how I can create my package to output the files in the format as above.

    Regards

  • I'd probably leave the package exporting to a fixed file name and add a final File System Task (or Script Task if you prefer to write a bit of code) to do a copy/rename to your desired destination.

    As far as setting the file name, I'd use a variable whose contents are defined as an expression.

    Here's something to get you started:

    (DT_WSTR, 50) Month(DATEADD("m",-1,getdate() ))

    This currently returns the unicode string '12', which is last month as a numeric.

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

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

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