Overview
To get data from an ERP instance into your workbook, use the ACU.QUERY function, which returns the contents of a specified ERP object (as either an Excel array or - optionally - as an Excel table).
You can use the Query Builder functionality to construct formulas visually.
Syntax
=ACU.QUERY(
ConnectionName,
Object,
Filter,
Select,
IncludeHeader,
Settings,
TableOutputCell
)
Arguments
|
Argument |
Required/Optional |
Description |
|---|---|---|
|
|
Optional |
Provide one of the following values:
OR Omit the argument to return results for all compatible connections with default aggregation settings. |
|
|
Required |
Name of the Acumatica DAC object to query. You can enter either the full name, including the namespace (for example, If a short name matches objects in more than one namespace, the function returns an error listing the matching objects, for example: The DAC reference 'ARAdjust' is ambiguous between 'PX.Objects.AR.ARAdjust' and 'PX.Objects.CA.Light.ARAdjust'. Please specify a fully qualified name. Use the full name instead. To find the full names of objects that share a short name, use ACU.EXPANDOBJECTRANGE with a If no object matches the name, the function returns an error such as The object 'GLBatch' is not found at 'Acumatica'. Use ACU.EXPANDOBJECTRANGE to check the object name. For querying related objects, use the You can use ACU.EXPANDOBJECTRANGE to explore available objects, and ACU.OBJECTDEFINITION to check their fields and navigation properties. Some objects return results only when you specify the |
|
|
Optional |
OData4 query based on the fields in the object. OData4 operators are supported, including: Use the ACU.QUERYFILTER function to create filter formulas ready to use with ACU.QUERY. Required for some objects. See Objects that require a filter. |
|
|
Optional |
Comma-separated list of columns to be included in the resulting dataset. Use the ACU.OBJECTDEFINITION function to get the list of the object fields. If you omit this argument, all the columns from the object will be returned. Rows where the selected columns have no value are included in the results - see Rows with no value in selected columns. |
|
|
Optional |
Accepted values: If set to If the |
|
|
Optional |
You can either enter a number (e.g. Two-dimensional array:
To make a filter case-insensitive, build it with the ACU.QUERYFILTER function and set its |
|
|
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. |
Output
The function returns a spill range (if OutputTableAddres is omitted) or an Excel table (if OutputTableAddress is specified) with the columns specified in the Select argument or with all columns if the Select argument is omitted.
Rows with no value in selected columns
The function returns all matching rows, including rows where the selected columns have no value. Blank cells in the results are expected and are not an error. A row appears entirely blank only when none of the selected columns has a value for that record.
Because every matching record produces a row, the spilled range sizes to the number of matching records, not to the number of populated values. Account for this in any downstream formula or conditional formatting that depends on the size of the result.
To exclude rows with no value in a column, add a condition to the Filter argument.
=ACU.QUERY(
"Acumatica",
"Contact",
ACU.QUERYFILTER("Acumatica","Contact",,"EMAIL","<>null"),
"CONTACTID,EMAIL"
)
Description: Returns CONTACTID and EMAIL from the Contact object, excluding contacts with no email address. ACU.QUERYFILTER renders the <>null criteria as the OData clause EMAIL ne null.
Objects that require a filter
The following Acumatica objects return one row per document for each date. Querying them without a filter can generate an extremely large result that Acumatica can't return in time. To prevent this, ACU.QUERY returns #N/A with the following message if you query these objects without the Filter argument:
A filter on 'SubmissionDate' is required for this object
|
Object |
Required filter field |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The check applies whether you enter the full or the short object name. Query Builder shows the same message when you select one of these objects and leave the filter empty.
To query these objects, add a condition on the SubmissionDate field to the Filter argument. A condition on a single date returns one row per document. A date range returns one row per document for each date in the range.
Even with a date condition, a query that matches many documents can return #N/A with the message The query returned no results. To avoid this, narrow the filter further, for example with a condition on the RefNbr field.
To check whether an object requires a filter, use ACU.EXPANDOBJECTRANGE with the IncludeDetails argument set to TRUE.
Query a single document on a date
=ACU.QUERY(
"Acumatica",
"ARAdjustedBalanceAtDate",
"SubmissionDate eq 2026-06-30 and RefNbr eq 'AR007527'",
"DocType,RefNbr,SubmissionDate,LineTotal,CuryLineTotal"
)
Description: Returns the row for the document with reference number AR007527 on 30 June 2026.
Result:
Query a date range
=ACU.QUERY(
"Acumatica",
"ARAdjustedBalanceAtDate",
"SubmissionDate ge 2026-06-01 and SubmissionDate le 2026-06-03 and RefNbr eq '002266'",
"DocType,RefNbr,SubmissionDate,LineTotal,CuryLineTotal"
)
Description: Returns one row for each date from 1 June to 3 June 2026 for every document with the reference number 002266. In this example, two documents share that reference number (types CRM and PMT), so the result has six rows.
Result:
Excel Online
Loading large datasets with the GI() function 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 10 records
=ACU.QUERY(
"Acumatica",
"PX.Objects.GL.Batch",
,
,
,
10
)
Description: Returns the first 10 records from the PX.Objects.GL.Batch object. The full name is required here, because the short name Batch also matches PX.Objects.GL.ADL.Batch.
Result:
Filter
=ACU.QUERY(
"Acumatica",
"Contact",
"CLASSID eq 'LEADBUS'",
"CONTACTID,FULLNAME,EMAIL"
)
Description:
Returns the CONTACTID, FULLNAME and EMAIL fields from the CONTACT object where the CLASSID field is set to LEADBUS:
Result:
Send output to an Excel table
Other examples of creating Excel tables can be found in Table Mirroring.
=ACU.QUERY(
"Acumatica",
"PMLaborCostRate",
,
"RECORDID,EMPLOYEEID,RATE,CURYID,REGULARHOURS",
,
,
A2
)
Description:
Instead of displaying the results of the query starting in the cell containing the ACU.QUERY function, the function displays the specified fields from the Project object in an Excel data table with its origin in the cell specified by the OutputTableAddress argument (cell A2).
Result:
Return fields from a related object
-
Check available fields for the primary and related objects using the ACU.OBJECTDEFINITION function.
-
Create a formula that contains fields from the primary as well as a related object, for example:
=ACU.QUERY( , "PX.Objects.AR.ARAdjust", , "InvoiceID,CustomerByCustomerID.AcctName" )
Result:
Description:
Returns values from the field InvoiceID of the object PX.Objects.AR.ARAdjust, and values from the field AcctName of the object PX.Objects.AR.Customer identified by the navigation property CustomerByCustomerID.
Navigation properties for related objects are listed in the Type column, at the bottom of the list returned by ACU.OBJECTDEFINITION.