Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2012 Forums
 SSIS and Import/Export (2012)
 SSIS excel expression failure

Author  Topic 

gaktheknife
Starting Member

12 Posts

Posted - 2015-04-20 : 09:01:57
I have an SSIS expression that creates an excel file. This is the expression: "\\\\xeifile01\\Common\\General\\Operations\\RM\\Billing\\Control and Recon Reports\\Invoice_Gaps\\Invoice_Gaps_"+(DT_WSTR,4)DATEPART("yyyy",GetDate()) + RIGHT("0" + (DT_WSTR,2)DATEPART("mm",GetDate()) ,2) + RIGHT("0" + (DT_WSTR,2)DATEPART("dd",GetDate()),2) + ".xlsx"

The expression works fine if the excel file already exists. How do i get it to create an excel file if one is not there already?

gbritton
Master Smack Fu Yak Hacker

2780 Posts

Posted - 2015-04-20 : 09:06:07
Where are you using the expression?
Go to Top of Page

gaktheknife
Starting Member

12 Posts

Posted - 2015-04-20 : 09:24:53
In the properties of the excel destination connection
Go to Top of Page

gbritton
Master Smack Fu Yak Hacker

2780 Posts

Posted - 2015-04-20 : 09:42:20
Ok -- I solve the problem this way:

I have a template version of the excel file with the correct column defs and any formatting I need or want. Before the dataflow, I generate the new name using an expression like yours, then copy the template to the new file, using the new name. Then there is a file for the destination connection.
Go to Top of Page

gaktheknife
Starting Member

12 Posts

Posted - 2015-04-20 : 10:03:32
What would i use to do this? File system task?
Go to Top of Page

gbritton
Master Smack Fu Yak Hacker

2780 Posts

Posted - 2015-04-20 : 10:27:08
yup
Go to Top of Page

gaktheknife
Starting Member

12 Posts

Posted - 2015-04-20 : 10:58:19
got it. Thanks
Go to Top of Page
   

- Advertisement -