Print

Import Torn API Data to Google Sheets

In this guide, we’ll walk through how to pull player and market data from the Torn API directly into Google Sheets, using the API Connector add-on.

We'll first get an API key from Torn, and then set up a request to pull in information from Torn to your spreadsheet.

Contents

Before You Begin

Click here to install the API Connector add-on from the Google Marketplace.

Part 1: Get Your Torn API Key

  1. While logged into Torn, click the Account icon in the top right corner, and then Settings
    torn-settings
  2. From here click API Keys > +Create New Key
    torn-createkey
  3. You'll be prompted to name your key and select the level of access you'd like it to have. This page shows which access level corresponds to which data points. Click Add
    torn-addkey
  4. Your key is ready! Copy it and keep it safe, we'll use it shortly.
    torn-copykey

Part 2: Pull Torn Data into Sheets

To use your key, append it to the end of your API request. Here's a complete request configuration example.

  • ApplicationCustom
  • MethodGET
  • Request URLhttps://api.torn.com/market/?selections=itemmarket,timestamp&key=11111111
  • OAuthNone
  • Headers: None

The whole request should look like this:

torn-request1

Part 3: Notes

By default, some of the Torn API's endpoints will return data that gets parsed into separate columns. You can select API Connector's grid report style for a more compact output with fewer columns.

Part 4: API Documentation

Official API documentation: https://www.torn.com/api.html

The Torn API is divided into categories for User, Property, Faction, Company, Market, and Torn. You can retrieve data from any of these categories by entering the associated URL into API Connector.

In the documentation, click the Try It! button for a convenient way to construct and try out requests directly in the browser. That way you can simply copy and paste their auto-created URLs into the API Connector request URL field.
torn-try

12 thoughts on “Import Torn API Data to Google Sheets”

    • good question, but the API documentation only shows some timestamp and field filters, there's nothing about filtering by gender. You should be able to count results using native Sheets formulas like COUNT().

      Reply
  1. I managed to get some of the proposed scripts to work, but the first one responds with:
    error.code error.error
    16 Access level of this key is not high enough

    My API key is set as Limited Access

    Reply
    • Looks like they changed their API so you now need to make sure your API key has high enough access. I updated the article to reflect that.

      Reply
    • This post says you first get an item ID from https://api.torn.com/torn/?selections=items&key= , and then fetch prices for that item with https://api.torn.com/torn/196?selections=items&key=

      Reply

Leave a Comment

Jump To