How to truncate an excel file

  • Dear Experts,

    I run a report everyday that goes to an excel file. A send mail task is then used to send the excel file to management via email. The problem is that everytime the package runs, the data is somewhat appended and it is never overwritten.

    I am looking for a way to truncate the excel file so I can send new data every morning instead of new data and old data (snapshot sorta thing).

    I have been playing with the file system task, execute sql task but yet to figure it out. Any fresh ideas will be much appreciated !!

  • Hi,

    I have two ideas for solutions to this problem.

    First, the complex one: you could write a script task that uses the excel object model to clear the rows before appending new rows

    Second, the easier one: just save an empty excel file beneath your destination file. Before inserting records into the file (i.e. before opening the connection), just use the file system task to copy the template over the destination file. Noew your destination file is empty...

    WM_HOPETHATHELPS

    Guenter

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

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