Import Torn API Data to Google Sheets
Torn is a popular and intriguing text-based online RPG. 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.
- Step 1: Get your Torn API Key
- Step 2: Create your API Request URL
- Step 3: Pull Torn API Data into Sheets
- Step 4: Get More Data
- While logged into Torn, click the Preferences icon in the top right corner.
- 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.
We’ll first follow the Torn API documentation to access 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:
We can now enter all our values into API Connector and import Torn data into Google Sheets.
- Open up Google Sheets and click Add-ons > API Connector > Create New API Request.
- In the Create Request interface, enter the Request URL we just created
- We don't need any headers, so just leave that section blank.
- Create a new tab. You can call it whatever you like, but here we'll call it 'items'. While still in that tab, click 'Set' to use that tab as your data destination.
- Name your request. Again we'll call it 'items'
- Click Run and a moment later you’ll see item stats printed into your sheet.
- 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):
- By default, some of the Torn API's endpoints will return data that gets parsed into separate columns. You can select API Connector's compact report style for a more compact output with fewer columns.
- Click the Try It! button for a convenient way to construct and try out requests in the browser before copying them into API Connector. From there, you can simply copy and paste their auto-created URL into the API Connector request URL field.