What is the Ad-hoc Query

In addition to running pre-made Reports and Templates in Google Sheets, the Kloudio add-on also supports running ad-hoc queries. Ad-hoc queries are SQL statements entered directly in Google Sheets eliminating the need to pre-make a report in the Kloudio portal. Ad-hoc queries also can be saved for later use as a Report.

Set Up

1: Create a Connection

The ad-hoc query needs a database connection in order to be used. This connection can be reused for multiple queries and shared via the Kloudio portal. To create a connection please visit creating a database connection.

2: Install the Kloudio add-on in Google Sheets

In order to use the connection in Google Sheets, the Kloudio add-on must be installed.

3: Select Ad-hoc Query from the add-on menu

Go to Add-ons -> Kloudio -> Adhoc Query

NOTE: If this is the first time running the add-on or the session has expired, logging in is required. After logging in, the sidebar defaults to “Reports”, and “Adhoc” will need to be re-selected from the Kloudio add-on.

4: Create Your Query

Select a connection for the query to use. If saving the query for repeated use, provide a name; otherwise the name is optional.

NOTE: By default, “New Sheet” is selected. When deselected, the current focused cell will serve as the first row and column of the result.


Place or write your query into the SQL editor.


In addition to entering the direct SQL, clicking on the Schema Browser icon (circled in red) triggers a popup allowing you to see tables and columns to include in the query.

Save the query if running in the future is desired.

5: Run the QueryExpression

Click Run at the bottom of the side window to run the query.

Multiple Queries

Multiple queries can be run and displayed by selecting another cell and entering a new query. These can be from the same or different connections, allowing multiple tables or data sources to be combined into a single sheet.

Select the cell where the first row and column will be returned for the next query.

Enter another query

Run the query


The Ad-hoc query imports data from a data source or multiple data sources into Google Sheets without the need to enter the Kloudio portal after the initial connection is created. Connections can be shared to teammates to create their own queries, or Google Sheets can be shared to view and manipulate data that has been returned.

If you have further questions about the Ad-hoc Query function, please contact us at support@kloud.io.

Did this answer your question?