Excel Spreadsheet Automation on UKG Pro WFM Data with the QUERY Formula

Jerod Johnson
Jerod Johnson
Director, Technology Evangelism
Pull data from UKG Pro WFM, automate spreadsheets, and more with the QUERY formula.

The CData Excel Add-In for UKG Pro WFM provides formulas that can query UKG Pro WFM data. The following three steps show how you can automate the following task: Search UKG Pro WFM 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 UKG Pro WFM data records you want to retrieve, written in standard SQL.
  • Connection: Either the connection name, such as APIConnection1, or a connection string. The connection string consists of the required properties for connecting to UKG Pro WFM data, separated by semicolons.

    Start by setting the Profile connection property to the location of the UKGProWFM Profile on disk (e.g. C:\profiles\UKGProWFM.apip). Next, set the ProfileSettings connection property to the connection string for UKGProWFM (see below).

    UKGProWFM API Profile Settings

    UKG Pro Workforce Management uses OAuth 2.0 with the Resource Owner Password Credentials grant (grant_type=password) to authorize access to the API. Unlike most OAuth-based profiles, this does not use a browser redirect/authorization-code step: the driver exchanges your UKG Pro WFM username, password, client ID, and client secret directly for an access token.

    Set the following connection properties to authenticate:

    • AuthScheme: Set this to OAuthPassword.
    • Host: Set this to the hostname of your UKG Pro Workforce Management datacenter/tenant (for example, yourcompany.mykronos.com). Do not include the protocol (https://) or a trailing slash.
    • OAuthClientId: Set this to the client ID issued for your UKG Pro Workforce Management OAuth application.
    • OAuthClientSecret: Set this to the client secret issued for your UKG Pro Workforce Management OAuth application.
    • User: Set this to your UKG Pro Workforce Management username.
    • Password: Set this to your UKG Pro Workforce Management password.

    Access tokens are obtained from https://{Host}/api/authentication/access_token. Refresh tokens issued by UKG Pro Workforce Management expire after 7 days; if a refresh attempt fails because the refresh token itself has expired, the driver must re-authenticate with your User/Password credentials to obtain a new access token.

  • 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 UKG Pro WFM data, such as PersonId.
  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 Employees WHERE PersonId = '"&B9&"'","Profile="&B1&";AuthScheme="&B2&";ProfileSettings="&B3&";User="&B4&";Password="&B5&";'="&B6&";OAuthClientId="&B7&";OAuthClientSecret="&B8&";Provider=API",B10)
    Formula inputs used in this example. (Google Apps is shown.)
  4. Change the filter to change the data. The outputs of the formula. (Google Apps is shown.)

Ready to get started?

Connect to live data from UKG Pro WFM with the API Driver

Connect to UKG Pro WFM