SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2005 Forums
 Other SQL Server Topics (2005)
 Data into Excel Cells?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

murrayb3024
Yak Posting Veteran

79 Posts

Posted - 12/11/2012 :  15:19:07  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

India
2202 Posts

Posted - 12/14/2012 :  05:54:29  Show Profile  Reply with Quote
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

India
52309 Posts

Posted - 12/14/2012 :  06:00:07  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

United Kingdom
2004 Posts

Posted - 12/15/2012 :  11:36:17  Show Profile  Visit jackv's Homepage  Reply with Quote
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

Edited by - jackv on 12/15/2012 11:39:21
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000