Excel Spreadsheet Automation on Sentry Data with the QUERY Formula

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

The CData Excel Add-In for Sentry provides formulas that can query Sentry data. The following three steps show how you can automate the following task: Search Sentry 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 Sentry 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 Sentry data, separated by semicolons.

    Using API Key Authentication

    Sentry uses token-based authentication. To obtain an Auth Token:

    1. Log in to your Sentry account at https://sentry.io
    2. Navigate to Settings > Auth Tokens
    3. Click "Create New Token"
    4. Select the required scopes and click "Create Token"
    5. Copy the generated token (it will only be shown once)

    After obtaining your Auth Token, set the following connection properties:

    • AuthScheme: Set this to APIKey.
    Set the following in the ProfileSettings connection property:
    • APIKey: Set this to your Sentry Auth Token.
    • OrganizationId: Set this to your Sentry organization slug or ID.

    Example Connection String

    Profile=C:\profiles\Sentry.apip;AuthScheme=APIKey;ProfileSettings="APIKey=your_auth_token;OrganizationId=your_org_slug";
    

    Connecting to Sentry

    Once the authentication is configured, you can connect to Sentry and query data from any of the available tables such as Organizations, Projects, Issues, and Events.

  • 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 Sentry data, such as .
  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 UserOrganizations WHERE  = '"&B6&"'","Profile="&B1&";AuthScheme="&B2&";ProfileSettings="&B3&";OrganizationId="&B4&";Provider=API",B7)
  4. Change the filter to change the data.

Ready to get started?

Connect to live data from Sentry with the API Driver

Connect to Sentry