Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Every month I have to fill in an Excel template with data from some database, that is I have to fill in about 100 cells.

I wrote SQL queries and I don't know is there any way that I could get that data into the Excel template other than copy/paste?

share|improve this question

In the Data tab in the ribbon, click on the From Other Sources tab. Choose Sql Server.

Type the name of the SQL Server computer in the Server name box.
Under Log on credentials, do one of the following:
a. To use your current Microsoft Windows user name and password, click Use Windows Authentication.
b. To enter a database user name and password, click Use the following User Name and Password, and then type your user name and password in the corresponding User Name and Password boxes.

You can also paste in your SQL query via the Properties tab (after a connection is set up, under the connections pane).

More details

share|improve this answer
Does this not address just one of the two parts? i.e. it describes how to make a connection but doesn't explain how to get the results of the query into a data range in Excel? – Assad Ebrahim Nov 1 '13 at 15:11
@AKE, no, the link shows the lot including where to put the data. However, this pretty much pops up and you're auto prompted so I didn't feel the need to include it. – Dave Nov 1 '13 at 15:15
Ah, missed the link! As a potentially useful summary: If the connection is successful, you'll see available tables > Choose a table. You'll then see an Import Data dialog box. Select how you want to view the data in your workbook... (table, pivot, etc.) > Properties... gives access to the Definition tab where you can write specific SQL the Command Text edit box. Clicking OK will pull back a table to the location you specified, including header row. – Assad Ebrahim Nov 1 '13 at 16:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .