Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase «««23456»»»

How to Dynamically and Iteratively Populate An Excel Workbook from SQL Server Expand / Collapse
Author
Message
Posted Thursday, January 10, 2008 12:30 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Thursday, January 31, 2008 9:20 AM
Points: 10, Visits: 24
So you mean that first I connect to the sample file in the Excel Destination and then change to the variable?

and when I change to variable it will not ask again for column mappings.

Thanks a lot for your help.
Post #441395
Posted Thursday, January 10, 2008 4:20 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Thursday, January 31, 2008 9:20 AM
Points: 10, Visits: 24
There is something still missing in this article. Can you please provide a step by step how you configure the Excel destination?

I created an Excel file and connected to it the sample Excel file with column names. The excel destination was created successfully and I ran the package and it created the groups and subgroups successfully but without any records because all the records were filled in the sample excel file Excel.xls which is correct because that is the destination.

Here are the successful configuration
Excel connection Manager
Table or view
Sheet1$

After that I modified the Excell Destination to assign the variable SubGroup but it won't allow me and it gives me the following error: A Destination table name has not been provided. The variable subGroup is being assigned in the foreach loop correctly but it won't accept it. I looked a the variable SubGroup and by default it is empty.
Here are the failure configuration:
Excel connection Manager
Table or view from variable
user::subGroup


Am I missing anything here?

You help is appreciated. Thanks in advance.
Post #441530
Posted Thursday, January 10, 2008 4:28 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Wednesday, June 11, 2014 3:33 PM
Points: 112, Visits: 239
I'm having troubles too. This article is hard to follow and read.
Post #441531
Posted Thursday, January 10, 2008 4:35 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Thursday, January 31, 2008 9:20 AM
Points: 10, Visits: 24
one additinal note here of what I did:

In order to be able to connect to the Excel File (Excel.xls the sample that has column names) I had to delete the expression of the connection manager and run the package and that's when it worked. After that I added the expression Filepath = @[User::filename] and that's when it didn't allow me to assign the subGroup variable.

In the article at the variable section you are talking about Grouping and subgrouping variables. Are these the User::Group and User::SubGroup variables or there are other ones? I think they are but it is not working.
Post #441532
Posted Thursday, January 10, 2008 5:00 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Monday, November 30, 2009 8:07 PM
Points: 15, Visits: 40
Listing Variables in the article:

ExcelTab
ExcelFileName
SubDataSet
obj_ListofGrouping
Grouping
SubGrouping

This is a situation of variables within variables. Grouping is used to define the ExcelFileName which is used in the Excel Connection Manager

Subgrouping is used to create the spreadsheet as:

"CREATE TABLE" + " " + "`"+@[User::SubGrouping] +"`"+ " " + "(
`Value1` NVARCHAR(35),
`Value2` NVARCHAR(40),
`Value3` NVARCHAR(200),
`Value4` NVARCHAR(50),
`Value5` NVARCHAR(15)

which is the expression within the ExcelTab variable

SubDataSet is the Select statement used to retrieve the data to populate the spreadsheets.

For me the simplest was to create the variables. Then add the components and then define each of the components.
Post #441539
Posted Thursday, January 10, 2008 5:39 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, September 3, 2008 12:09 PM
Points: 1, Visits: 14
First, I'd like to thank the author for this article, it's very interesting and useful. I would recommend that in the future the author take larger/clearer screenshots (or link to expanded images) and break down the steps in greater detail. I also recommend the creation of dummy tables at the beginning so that anyone attempting to recreate this package is using the same data and not initially dealing with whatever idiosyncrasies they have in their own dbs. I found it exceedingly difficult to recreate this package and ended up spending a helluva lot of time squinting, muttering, and guessing, and it doesn't sound like I'm the only one.

Thanks for the article and I look forward to more.
Post #441543
Posted Thursday, January 10, 2008 6:15 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Monday, November 30, 2009 8:07 PM
Points: 15, Visits: 40
Yeah, I totally agree. I think I had hoped everyone could download the article so that way could expand the screenprints to any size they wanted. If you would like any screenprints please feel free to email me directly.

Thanks again for all the comments which will only help to improve my writing.
Post #441548
Posted Thursday, January 10, 2008 6:55 PM


SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: 2 days ago @ 12:10 PM
Points: 49, Visits: 279
Yes please, give us a link where we can get the full article, full screen shots and a link to download the working sample package.

This really is a great article. It deserves a sequel.

I already get a lot of traction from my management to piggy-back on it. When I spoke about your idea, my boss answered with a barrage of requests for new BI solutions. I have got work for at least 3 days :D

One side idea I have is to use existing Excel templates where I have pivot tables sourced from named ranges and auto-refresh on open set to true.
This is like I like it, simple, smart and cheap.

I even derived a version for Hyperion out of it


BI Guy
Post #441551
Posted Thursday, January 31, 2008 7:50 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Thursday, September 9, 2010 6:31 AM
Points: 15, Visits: 25
What about dynamic datasets? i.e. datasets that changes in columns, let's say for example 2 columns in dataset 1 and 15 columns in dataset 2
Post #449950
Posted Thursday, January 31, 2008 8:33 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Monday, November 30, 2009 8:07 PM
Points: 15, Visits: 40
Good question! I have not tried it with changing numbers of columns/tab or file. Any ideas anyone?

Hmmm, are we saying that the TABLE itself has multiple columns but not ALL of them have data at any one time? If so, I would try to select ALL the cols. Then either have blank cols on some tabs....or look for a way to suppress the blank/no data cols....
Post #449989
« Prev Topic | Next Topic »

Add to briefcase «««23456»»»

Permissions Expand / Collapse