Excel Spreadsheet Automation with the QUERY Formula

Ready to get started?

Download for a free trial:

Download Now

Learn more:

Excel Add-In for SAP Business One DI

The SAP Business One DI Excel Add-In is a powerful tool that allows you to connect with live SAP Business One DI data, directly from Microsoft Excel.

Use Excel to read, write, and update SAP Business One DI Accounts, Activities, Orders, Customers, etc. Perfect for mass imports / exports / updates, data cleansing & de-duplication, Excel based data analysis, and more!

Pull data, automate spreadsheets, and more with the QUERY formula.

The CData Excel Add-In for SAP Business One DI provides formulas that can query SAP Business One DI data. The following three steps show how you can automate the following task: Search SAP Business One DI data for a user-specified value and then organize the results into an Excel spreadsheet.

The syntax of the CDATAQUERY formula is the following: =CDATAQUERY(Query, [Connection], [Parameters], [ResultLocation]);

This formula requires three inputs:

  • Query: The declaration of the SAP Business One DI data records you want to retrieve, written in standard SQL.
  • Connection: Either the connection name, such as SAPBusinessOneDIConnection1, or a connection string. The connection string consists of the required properties for connecting to SAP Business One DI data, separated by semicolons.

    To connect to SAP Business One DI data, specify the following connection properties:

    • DBServerType: The type of server being connected to.
    • Server: The name or IP address of the Business One DI server to connect to.
    • CompanyDB: The company to connect to.
    • User: The username used when connecting to the LicenseServer.
    • Password: The password used when connecting to the LicenseServer.
    • LicenseServer (optional): Set this if your License Server is different from the Server.
    • UseTrusted (optional): Set to TRUE to connect using Windows credentials.
  • ResultLocation: The cell that the output of results should start from.

Pass Spreadsheet Cells as Inputs to the Query

The procedure below results in a spreadsheet that organizes all the formula inputs in the first column.

  1. Define cells for the formula inputs. In addition to the connection inputs, add another input to define a criterion for a filter to be used to search SAP Business One DI data, such as AcctName.
  2. In another cell, write the formula, referencing the cell values from the user input cells defined above. Single quotes are used to enclose values such as addresses that may contain spaces.
  3. =CDATAQUERY("SELECT * FROM OACT WHERE AcctName = '"&B6&"'","Server="&B1&";DBServerType="&B2&";CompanyDB="&B3&";User="&B4&";Password="&B5&";Provider=SAPBusinessOneDI",B7)
  4. Change the filter to change the data.