Returns the result of a SQL query as an array. This is a CSE/Array formula, so it must be entered into a range at once using Ctrl+Shift+Enter.

This is the quickest way to return database results into Excel, but it limits your options for altering the query.

XL3TableArrayLookup( Connection, Sql, [HeaderHandling] )

ParameterDescription
ConnectionConnection number to use
SqlThe query to run. Typically from a cell so that the query can be updated.
HeaderHandling

Optional, how to output headers:

  • 0/Missing – Headers not displayed
  • 1 – Headers displayed

In this example, you have a SQL statement in cell A1. Select the range you want to output the results to and type: Select * From Person.ContactType

Then press Ctrl+Shift+Enter.

Any cells outside the data area return #N/A. The date column has also been formatted.