BC.QUERY
Overview
Use the BC.QUERY function to return a list of objects of a specified Business Central object type (as either an Excel array or an Excel table), filtered to match provided criteria.
Syntax
=BC.QUERY(
ConnectionName,
Object,
Filter,
Select,
IncludeHeader,
Settings,
OutputTableAddress
)
Arguments
The BC.QUERY function uses the following arguments:
Argument | Required/Optional | Description |
ConnectionName | Required | The name of the connection, as specified in the Connection Manager |
Object | Required | Business Central object name (e.g., Use the BC.EXPANDOBJECTRANGE function to retrieve the list of Business Central objects. |
Filter | Optional | OData4 query based on the fields in the object. OData4 operators are supported, including: |
Select | Optional | Comma-separated list of object fields to be included in the resulting dataset. If this argument is empty, all the Fields from the Object will be returned. |
IncludeHeader | Optional |
|
Settings | Optional | Two-dimensional array
|
OutputTableAddress | Optional | If the argument is specified, the function output is represented as an Excel table, and the first column in the If the argument is omitted, the result is returned as an array. |
Excel Online
Important: Loading large datasets with BC.QUERY is not performant in Excel Online due to the limitations of the Excel platform in the browser. If your dataset contains more than approximately 100,000 records, we strongly recommend using a desktop version of Excel 365 for Windows or Mac OS.
Examples
First ten records
=BC.QUERY(
"BC",
"generalLedgerEntries",
,
,
,
10
)
Description: Returns the first 10 records found for the Object generalLedgerEntries
.

Filters and column selection
=BC.QUERY(
"BC",
"salesinvoices",
"sellToState eq 'ON' and status eq 'Paid'",
"number,customerNumber,invoiceDate,totalAmountExcludingTax"
)
Description: Returns the number
, customerNumber
, invoiceDate
and totalAmountExcludingTax
fields for all salesInvoices
object with the status Paid
, issued to customers in the province of Ontario.
