Excel Spreadsheet Automation with the QUERY Formula



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

The CData Excel Add-In for Presto provides formulas that can edit, save, and delete Presto data. The following three steps show how you can automate the following task: Search Presto data for a user-specified value and then organize the results into an Excel spreadsheet.

About Presto Data Integration

Accessing and integrating live data from Trino and Presto SQL engines has never been easier with CData. Customers rely on CData connectivity to:

  • Access data from Trino v345 and above (formerly PrestoSQL) and Presto v0.242 and above (formerly PrestoDB)
  • Read and write access all of the data underlying your Trino or Presto instances
  • Optimized query generation for maximum throughput.

Presto and Trino allow users to access a variety of underlying data sources through a single endpoint. When paired with CData connectivity, users get pure, SQL-92 access to their instances, allowing them to integrate business data with a data warehouse or easily access live data directly from their preferred tools, like Power BI and Tableau.

In many cases, CData's live connectivity surpasses the native import functionality available in tools. One customer was unable to effectively use Power BI due to the size of the datasets needed for reporting. When the company implemented the CData Power BI Connector for Presto they were able to generate reports in real-time using the DirectQuery connection mode.


Getting Started


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

This formula requires three inputs:

  • Query: The declaration of the Presto data records you want to retrieve or the modifications to be made, written in standard SQL.
  • Connection: Either the connection name, such as PrestoConnection1, or a connection string. The connection string consists of the required properties for connecting to Presto data, separated by semicolons.

    Set the Server and Port connection properties to connect, in addition to any authentication properties that may be required.

    To enable TLS/SSL, set UseSSL to true.

    Authenticating with LDAP

    In order to authenticate with LDAP, set the following connection properties:

    • AuthScheme: Set this to LDAP.
    • User: The username being authenticated with in LDAP.
    • Password: The password associated with the User you are authenticating against LDAP with.

    Authenticating with Kerberos

    In order to authenticate with KERBEROS, set the following connection properties:

    • AuthScheme: Set this to KERBEROS.
    • KerberosKDC: The Kerberos Key Distribution Center (KDC) service used to authenticate the user.
    • KerberosRealm: The Kerberos Realm used to authenticate the user with.
    • KerberosSPN: The Service Principal Name for the Kerberos Domain Controller.
    • KerberosKeytabFile: The Keytab file containing your pairs of Kerberos principals and encrypted keys.
    • User: The user who is authenticating to Kerberos.
    • Password: The password used to authenticate to Kerberos.
  • 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 Presto data, such as Id.
  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 Customer WHERE Id = '"&B3&"'","Server="&B1&";Port="&B2&";Provider=Presto",B4)
  4. Change the filter to change the data.

Ready to get started?

Download a free trial of the Excel Add-In for Presto to get started:

 Download Now

Learn more:

Presto Icon Excel Add-In for Presto

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

Use Excel to read, write, and update Presto Tables, etc. Perfect for mass imports / exports / updates, data cleansing & de-duplication, Excel based data analysis, and more!