Excel Spreadsheet Automation with the QUERY Formula

Ready to get started?

Download for a free trial:

Download Now

Learn more:

Excel Add-In for Paylocity

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

Use Excel to read, write, and update Paylocity FALSE, 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 Paylocity provides formulas that can edit, save, and delete Paylocity data. The following three steps show how you can automate the following task: Search Paylocity 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 Paylocity data records you want to retrieve or the modifications to be made, written in standard SQL.
  • Connection: Either the connection name, such as PaylocityConnection1, or a connection string. The connection string consists of the required properties for connecting to Paylocity data, separated by semicolons.

    Set the following to establish a connection to Paylocity:

    • RSAPublicKey: Set this to the RSA Key associated with your Paylocity, if the RSA Encryption is enabled in the Paylocity account.

      This property is required for executing Insert and Update statements, and it is not required if the feature is disabled.

    • UseSandbox: Set to true if you are using sandbox account.
    • CustomFieldsCategory: Set this to the Customfields category. This is required when IncludeCustomFields is set to true. The default value for this property is PayrollAndHR.
    • Key: The AES symmetric key(base 64 encoded) encrypted with the Paylocity Public Key. It is the key used to encrypt the content.

      Paylocity will decrypt the AES key using RSA decryption.
      It is an optional property if the IV value not provided, The driver will generate a key internally.

    • IV: The AES IV (base 64 encoded) used when encrypting the content. It is an optional property if the Key value not provided, The driver will generate an IV internally.

    Connect Using OAuth Authentication

    You must use OAuth to authenticate with Paylocity. OAuth requires the authenticating user to interact with Paylocity using the browser. For more information, refer to the OAuth section in the Help documentation.

    The Pay Entry API

    The Pay Entry API is completely separate from the rest of the Paylocity API. It uses a separate Client ID and Secret, and must be explicitly requested from Paylocity for access to be granted for an account. The Pay Entry API allows you to automatically submit payroll information for individual employees, and little else. Due to the extremely limited nature of what is offered by the Pay Entry API, we have elected not to give it a separate schema, but it may be enabled via the UsePayEntryAPI connection property.

    Please be aware that when setting UsePayEntryAPI to true, you may only use the CreatePayEntryImportBatch & MergePayEntryImportBatchgtable stored procedures, the InputTimeEntry table, and the OAuth stored procedures. Attempts to use other features of the product will result in an error. You must also store your OAuthAccessToken separately, which often means setting a different OAuthSettingsLocation when using this connection property.

  • 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 Paylocity data, such as EmployeeId.
  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 Employee WHERE EmployeeId = '"&B6&"'","OAuthClientID="&B1&";OAuthClientSecret="&B2&";RSAPublicKey="&B3&";Key="&B4&";IV="&B5&";Provider=Paylocity",B7)
  4. Change the filter to change the data.