Search API Connector Documentation

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 Preferences icon in the top right corner.
    torn-img1
  2. Click on API Key. That’s it! You’ll see your API key displayed. Copy this and keep it safe; we’ll need it shortly.
    torn-img2

Part 2: Create Your API Request URL

We’ll first get some item data.

  • API root: https://api.torn.com
  • Query Strings: ?selections=items&key=YOUR_API_KEY

Putting it all together, we get the full API Request URL:

https://api.torn.com/user/?selections=items&key=YOUR_API_KEY

Part 3: Pull Torn API Data into Sheets

Now let’s copy that URL into API Connector.

  1. Open up Google Sheets and click Extensions > API Connector > Open.
  2. In the Create screen, enter the Request URL we just created
    torn-img3
  3. We don’t need any OAuth, so just leave that set to None. We don’t need headers either, so just leave that section blank.
  4. Create a new tab and click Set current to use that tab as your data destination.
  5. Name your request and click Run. A moment later you’ll see item stats printed into your sheet.torn-img4

Part 4: More Example API URLs

  1. You can check the documentation for the full list of available API requests,  but if you just want to jump in, you can play around with the URLs you enter in the API URL path field. Try the following (one at a time):
    https://api.torn.com/user/1?key=YOUR_API_KEY
    https://api.torn.com/property?key=YOUR_API_KEY
    https://api.torn.com/market?key=YOUR_API_KEY
    https://api.torn.com/torn/?selections=items&key=YOUR_API_KEY
    https://api.torn.com/torn/?selections=medals&key=YOUR_API_KEY
    https://api.torn.com/torn/?selections=honors&key=YOUR_API_KEY
  2. 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 5: API Documentation

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

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

Previous Import Toggl Data to Google Sheets
Next Import Trello Data to Google Sheets

8 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

Leave a Comment

Table of Contents