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 123»»»

How to Read Excel Cells from SQL Server Integration Services Expand / Collapse
Author
Message
Posted Tuesday, April 27, 2010 9:48 PM


SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Friday, March 14, 2014 2:21 AM
Points: 912, Visits: 205
Comments posted to this topic are about the item How to Read Excel Cells from SQL Server Integration Services






My Blog: http://dineshasanka.spaces.live.com/
Post #911600
Posted Wednesday, April 28, 2010 12:37 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Yesterday @ 11:37 PM
Points: 12,239, Visits: 9,213
Nice article. I will never ever use the first option as it is too rigid, but the second one is very interesting and very promising.



How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?

Member of LinkedIn. My blog at LessThanDot.

MCSA SQL Server 2012 - MCSE Business Intelligence
Post #911643
Posted Wednesday, April 28, 2010 1:51 AM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Tuesday, April 22, 2014 2:24 AM
Points: 80, Visits: 324
Thanks for the article. It seems way too common to get data 1) in Excel (ugh) and 2) completely formatted with no usable way to extract the data. I usually tell users to put the data in columnar format. Now I guess there are other options, but I'm not sure I am going to tell them that...;O)
Post #911681
Posted Wednesday, April 28, 2010 2:03 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Sunday, June 27, 2010 1:07 AM
Points: 6, Visits: 17
Hi I have a question what if there is picture in the excel file how do you pick the picture from the file. Can you shed some light on it.

Post #911685
Posted Wednesday, April 28, 2010 2:07 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, February 26, 2014 12:28 AM
Points: 6, Visits: 295
Hi there,

nice article. Will bookmark it ;)

The only thing that comes up to my mind is that using excel on the server even through the assembly is never a good idea, since there is no way to debug and errors cannot be seen. Instead use something like syncfusion or so.

Rgds

Daniel
Post #911686
Posted Wednesday, April 28, 2010 2:13 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Friday, April 18, 2014 12:24 AM
Points: 203, Visits: 1,304
Thank you Dinesh.
If it comes to read individual cells I think it is much easier to use Excel,
VBA, ADO and SQL . I do have of code examples if anybody is interested.

//Gosta
Post #911687
Posted Wednesday, April 28, 2010 2:18 AM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Monday, June 11, 2012 8:59 PM
Points: 88, Visits: 33
Hi There,

Nice article, I will look at using this in future

previously, I have used the ACE driver to access Excel in the past with pivots to switch the data between rows and columns, the benefit of using the ACE driver is that you can link the queries etc to other SQL statements. also you only need to install the ACE driver on the server and not the Excel runtime - an element that many of the server admins that I have worked with didn't want on their servers.

Also with the ACE or OLEDB jet providers, you can specify specific cells and tabs within a spreadsheet.


below is my query that returns the same result as the one the article
select a.[Customer Name],
a.[Address],
a.[Sales Rep],
b.[Order Number],
b.[Order Date]
from (
select [Customer Name],
[Address],
[Sales Rep]
from (SELECT *
FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0',
'Excel 12.0 Xml;HDR=No;Database=C:\Projects\KPI Demo\IT 2009 Tester.xls;IMEX=1',
'SELECT * FROM [Department Details$A3:B5]')) as sourcetable
PIVOT
(MAX(F2)
for F1 in ([Customer Name],[Address],[Sales Rep])
) as PivotTable) a
cross join (
select null as [Customer Name],
[Order Number],
[Order Date]
from (SELECT *
FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0',
'Excel 12.0 Xml;HDR=No;Database=C:\Projects\KPI Demo\IT 2009 Tester.xls;IMEX=1',
'SELECT * FROM [Department Details$D3:E4]')) as sourcetable
PIVOT
(MAX(F2)
for f1 in ([Order Number],[Order Date])
) as PivotTable) b


Regards
Warren
Post #911692
Posted Wednesday, April 28, 2010 3:12 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Thursday, April 10, 2014 7:25 AM
Points: 11, Visits: 59
Hi - does this work with 64-bit editions of SQL Server? I found much to my frustration that it wasn't possible to set up a spreadsheet as a linked server in SQL2005-64, and my investigation at the time only found the solution of going via a 32-bit SQL Server installation, which isn't great.

Just wondered if this could be another way round the problem.
Post #911714
Posted Wednesday, April 28, 2010 3:20 AM


SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Friday, March 14, 2014 2:21 AM
Points: 912, Visits: 205
yes this is working in 64 bit. in fact, all my development are happening in 64 bit






My Blog: http://dineshasanka.spaces.live.com/
Post #911721
Posted Wednesday, April 28, 2010 3:23 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Thursday, April 10, 2014 7:25 AM
Points: 11, Visits: 59
That's excellent - thanks for posting - look forward to trying it out.
Post #911723
« Prev Topic | Next Topic »

Add to briefcase 123»»»

Permissions Expand / Collapse