DATABASE Export query to Excel function

Execute a SELECT query and write the results to an Excel (.xlsx) file.

Help CentreBuilding Processes

This article describes the RPA Database functionality to export query results to an Excel file.

For a full list of available functions, please read DATABASE functions.


Description

The Export query to Excel function executes a SELECT query and writes the results to an Excel (.xlsx) file. You can specify the sheet name for the output.


Setting it up

To use the Export query to Excel function, follow these instructions:

{{popups:rpas/add:action=db-export-excel}}

Once on a process map:

  1. Navigate to the process where you would like to add the Export query to Excel function
  2. Click on the green button's drop-down (right side of the green button labelled "Process")
  3. On the menu that appears, click on the "+ Activity" item
  4. From here you can select the Export query to Excel option
  5. Click "Add" once you are done

Input parameters

ParameterRequiredTypeDefaultDescription
NameYesText-The alias of a previously opened connection (from db-connect)
QueryYesText-The SQL SELECT statement to execute
PathYesText-The file path where the Excel file will be written (must end in .xlsx)
ParamsNoArray-An array of values for parameterised queries
Sheet nameNoTextSheet1The name of the worksheet in the Excel file

Output variables

This action does not produce output variables.


Errors

ErrorDescription
Connection not foundNo open connection exists with the specified name
Query errorThe SQL query contains a syntax error or references invalid objects
File write errorUnable to write to the specified file path

Tips

  • Use meaningful sheet names to make the exported file easier to navigate
  • The file path must end in .xlsx for proper Excel format
  • Use SELECT with specific column names and aliases for readable headers

Related functions

See it working on your own data

Everything documented here ships with the platform – try the document tools free, or go live in 7 days.