SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


How to Dynamically and Iteratively Populate An Excel Workbook from SQL Server


How to Dynamically and Iteratively Populate An Excel Workbook from SQL Server

Author
Message
imaddaou
imaddaou
SSC Rookie
SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)

Group: General Forum Members
Points: 34 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.
imaddaou
imaddaou
SSC Rookie
SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)

Group: General Forum Members
Points: 34 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.
Tony Mungor
Tony Mungor
SSC Veteran
SSC Veteran (254 reputation)SSC Veteran (254 reputation)SSC Veteran (254 reputation)SSC Veteran (254 reputation)SSC Veteran (254 reputation)SSC Veteran (254 reputation)SSC Veteran (254 reputation)SSC Veteran (254 reputation)

Group: General Forum Members
Points: 254 Visits: 240
I'm having troubles too. This article is hard to follow and read.
imaddaou
imaddaou
SSC Rookie
SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)

Group: General Forum Members
Points: 34 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.
mdeschen1
mdeschen1
SSC Journeyman
SSC Journeyman (83 reputation)SSC Journeyman (83 reputation)SSC Journeyman (83 reputation)SSC Journeyman (83 reputation)SSC Journeyman (83 reputation)SSC Journeyman (83 reputation)SSC Journeyman (83 reputation)SSC Journeyman (83 reputation)

Group: General Forum Members
Points: 83 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.
omnicrondelicious
omnicrondelicious
Forum Newbie
Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)

Group: General Forum Members
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.
mdeschen1
mdeschen1
SSC Journeyman
SSC Journeyman (83 reputation)SSC Journeyman (83 reputation)SSC Journeyman (83 reputation)SSC Journeyman (83 reputation)SSC Journeyman (83 reputation)SSC Journeyman (83 reputation)SSC Journeyman (83 reputation)SSC Journeyman (83 reputation)

Group: General Forum Members
Points: 83 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.
Philippe Cand
Philippe Cand
SSC Veteran
SSC Veteran (296 reputation)SSC Veteran (296 reputation)SSC Veteran (296 reputation)SSC Veteran (296 reputation)SSC Veteran (296 reputation)SSC Veteran (296 reputation)SSC Veteran (296 reputation)SSC Veteran (296 reputation)

Group: General Forum Members
Points: 296 Visits: 294
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 BigGrin

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 w00t

BI Guy
pieter.olivier
pieter.olivier
Grasshopper
Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)Grasshopper (15 reputation)

Group: General Forum Members
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
mdeschen1
mdeschen1
SSC Journeyman
SSC Journeyman (83 reputation)SSC Journeyman (83 reputation)SSC Journeyman (83 reputation)SSC Journeyman (83 reputation)SSC Journeyman (83 reputation)SSC Journeyman (83 reputation)SSC Journeyman (83 reputation)SSC Journeyman (83 reputation)

Group: General Forum Members
Points: 83 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....
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search