Sunday, March 25, 2012

downloading data to excel

Hi,

I want to download data to excel in which each filename varies depending on the day i download them.

Ex.

ExportFile_09272007.xls

Can this be possible?

cherriesh

You need a variable to build the name of the Excel file.

In a script use this variable to create the excel file.

Then create your excel connection to an existing file and in the expressions of this connection assign the value to the ExcelFilePath & ServerName.

I hope it helps!

|||

hi,

what i did, in the expressions property (connectionstring) of the excel connection manager, i put this path:

"C:\\Cube Reports\\Excel\\" + @.[System:Stick out tongueackageName] + "Logs" +
(DT_STR,4,1252)DATEPART( "yyyy" , @.[System:Tongue TiedtartTime] ) +
RIGHT("0" + (DT_STR,4,1252)DATEPART( "mm" , @.[System:Tongue TiedtartTime] ), 2) +
RIGHT("0" + (DT_STR,4,1252)DATEPART( "dd" , @.[System:Tongue TiedtartTime] ), 2) +
RIGHT("0" + (DT_STR,4,1252)DATEPART( "hh" , @.[System:Tongue TiedtartTime] ), 2) +
RIGHT("0" + (DT_STR,4,1252)DATEPART( "mi" , @.[System:Tongue TiedtartTime] ), 2) +
RIGHT("0" + (DT_STR,4,1252)DATEPART( "ss" , @.[System:Tongue TiedtartTime] ), 2) +
".xls"

when i tried running the report, it gives me this error:

Nonfatal errors occurred while saving the package:

Error at ExportToExcel [connection manager "excel connection manager"]: the connection string formal is not valid. it must consist of one or more components of the form x=y, separated by semicolons. this error occurs when a connection string with zero components is set on database connection manager.

cherriesh

|||You have to set the ExcelFilePath not the Connection string property!|||

hi,

so here's what i've done, in the expression i set the excelfile path to "C:\\Cube Reports\\Excel"

I set the server name to "localhost"

what's the variable you mentioned? I don't have any script object. I only have oledb source, then excel destination.

can you detail the solution... thanks a lot!!!

cherriesh

|||

The “excel destination” assumes that the Excel file exists. So you have to create your file, you can accomplish this with a “Script Task”. While creating the Excel file you have to provide the file name, this is the same that you need for the ExcelFilePath, so you can save it in a variable.

If you do it like that, you may have another code for getting the file name how ever I think your expression should return

“C:\Cube Reports\Excel\TestLogs20070927145711.xls”. I got that.

sql

No comments:

Post a Comment