Import SQL Server data into Excel

Posted on 2011-10-12
Medium Priority
Last Modified: 2012-08-14

I have to print a sheet with a list of labels containing the data from SQL Server.
I run a query that extracts data from a SQL server and prints it in three columns.
Please, see the attached excel file for how i need the labels to be formatted.

Each cell has to contain the following data:
ITEM_NO_123 -  item number
English Description - english description
Original description  -  description in original language.

Is it possible to do this? If yes, then how?

Many thanks in advance!
SELECT i.Item, i.Description, l.Description FROM MA_Items i
JOIN MA_ItemsLanguageDescri l ON l.Item = i.Item
WHERE l.Language LIKE 'TR'

Open in new window

Question by:Zaurb
1 Comment
LVL 12

Accepted Solution

kgerb earned 1000 total points
ID: 36957357
Not sure if this is exactly what you're looking for.  If you can get the three fields as individual strings you can input them into a cell like this.
Sub CombineThreeStrings()
Dim s1 As String, s2 As String, s3 As String
s1 = "ITEM_NO_123"
s2 = "English Description"
s3 = "Original Description"
Range("G6") = s1 & vbNewLine & s2 & vbNewLine & s3
End Sub

Open in new window

Let me know if something needs tweaking or if I missed the boat completely.


Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
Manually copying shapes and their assigned macros one by one to a new location can be tedious, but if you use the Excel utility workbook attached to this article, the process will be much quicker and easier.
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

588 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question