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 2005 Forums
 Other SQL Server Topics (2005)
 Data into Excel Cells?

Author  Topic 

murrayb3024
Yak Posting Veteran

79 Posts

Posted - 2012-12-11 : 15:19:07
A user has an excel document and there are 5 specific cells they need to populate. The data is in one of our SQL databases. Is it possible to create a new copy of that excel doc with those fields populated for each record? There are around 2000 records they don't want to manually populate each one.

I have never tried this before so not even sure if this possible or not.

bandi
Master Smack Fu Yak Hacker

2242 Posts

Posted - 2012-12-14 : 05:54:29
Do you mean that insertion of table data into an excel file?

--
Chandu
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-12-14 : 06:00:07
you can write a disributed query based on OPENROWSET for updating those excel cells from SQL server.

see

http://support.microsoft.com/kb/321686

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

jackv
Master Smack Fu Yak Hacker

2179 Posts

Posted - 2012-12-15 : 11:36:17
You can complete this task using Powershell - which lets you reference\instantiate the Excel doc - and also specifically focus on certain cells.
You can also connect to the SQL Server Instance - execute the query - and place in the cells above.
Check the Excel COM object and the New-Object ('Microsoft.SqlServer.Management.Smo.Server') to connect to the SQL Server Instance

Jack Vamvas
--------------------
http://www.sqlserver-dba.com
Go to Top of Page
   

- Advertisement -