Excel Function : SQL.REQUEST
Category
Add-in and Automation
Description
Connects with an external data source and runs a query from a worksheet, then returns the result as an array without the need for macro programming
Microsoft Excel Reference Page
https://support.office.com/en-us/article/SQLREQUEST-function-4da47f3a-ff08-46ed-886c-3329aa5df008
Syntax and Description of the SQL.REQUEST Excel Function
I'm working on a VBA module in excel, and I want to use the SQL.REQUEST function to request a certain column from a certain table. I've got the connection string and everything set up, but I can't figure out how to format the SQL syntax to request a whole table.
Range("A1").Value = SQL.REQUEST("Server=myServerAddress;Database=myDataBase;Trusted_Connection=true", "SELECT * FROM Table1;")
A:
Try this:
Range("A1").Value = SQL.REQUEST("Server=myServerAddress;Database=myDataBase;Trusted_
About SQL.REQUEST Excel Function
The SQL.REQUEST function sends a request to a database and returns the results of the request as an array. The request can be a SQL query or a stored procedure. The function takes two arguments: the database connection string and the request string.