---
title: Get Crypto Prices with Airtable Scripts | Scott Hemmeter
description: Airtable can be a true No Code platform for you as it has a ton of capabilities without you needing to know how to code. However, it also offers features where one can leverage code. I do believe a No Code approach is your best first option for most solutions, but gaining an understanding of…
image: https://scotthemmeter.com/hubfs/Imported_Blog_Media/image-4-Jul-22-2022-07-01-53-69-PM.png
---

- [Home](https://scotthemmeter.com)
- [About](https://scotthemmeter.com/about/)
- [Contact](https://scotthemmeter.com/contact/)
- [Subscribe](https://scotthemmeter.com/contact/-0)
- [Airtable CRM Template](https://www.airtable.com/universe/expgN0YhrOxu9Nupm/crm-template-smb)

[Follow us on Instagram](https://www.linkedin.com/in/hemmeter) [Follow us on Facebook](https://www.twitter.com/hemmeter)

- [Home](https://scotthemmeter.com)
- [About](https://scotthemmeter.com/about/)
- [Contact](https://scotthemmeter.com/contact/)
- [Subscribe](https://scotthemmeter.com/contact/-0)
- [Airtable CRM Template](https://www.airtable.com/universe/expgN0YhrOxu9Nupm/crm-template-smb)

- [Home](https://scotthemmeter.com)
- [About](https://scotthemmeter.com/about/)
- [Contact](https://scotthemmeter.com/contact/)
- [Subscribe](https://scotthemmeter.com/contact/-0)
- [Airtable CRM Template](https://www.airtable.com/universe/expgN0YhrOxu9Nupm/crm-template-smb)

[Follow us on Instagram](https://www.linkedin.com/in/hemmeter) [Follow us on Facebook](https://www.twitter.com/hemmeter)

# Get Crypto Prices with Airtable Scripts

 28 Sep 2021

[Scott Hemmeter](https://scotthemmeter.com/author/scott-hemmeter)

![](https://scotthemmeter.com/hubfs/Imported_Blog_Media/image-4-Jul-22-2022-07-01-53-69-PM.png)

Airtable can be a true No Code platform for you as it has a ton of capabilities without you needing to know how to code. However, it also offers features where one can leverage code. I do believe a No Code approach is your best first option for most solutions, but gaining an understanding of how to accomplish things with code will make you and the system much more powerful.

I wanted to take a break from [my CRM series](https://scotthemmeter.com/?s=%22Airtable%3A+Creating+a+CRM%22) and go through a good scripting example. My next CRM series post will utilize a more complex scripting example than I am doing here, so this is a good one to get started and is an interesting use case.

## Airtable Scripting

As Airtable puts it…

> Scripting lets you write short scripts to reduce time spent on repetitive tasks and uncover deeper insights with advanced queries and custom reporting.
> 
> Learn more on [Airtable’s Developer Page](https://www.airtable.com/developers/scripting)

To get started, you can see some [example scripts](https://www.airtable.com/developers/scripting/examples), install scripts from the [marketplace](https://airtable.com/marketplace/category/scripts), collaborate with others in the [community](https://community.airtable.com/c/developers/scripting/56), or keep reading this post for a primer.

## Base Setup

Our goal is to have Airtable get current quotes for crypto. To get started, create a table called Coins. My table looks like below. If you want the script to work for you, please use the same field names.

![](https://scotthemmeter.com/hubfs/Imported_Blog_Media/basesetup.png)

A few nuances to this setup.

- **Name** & **Ticker** are Single Line Text fields
- **Market** is a formula field of `Ticker & "-USD"`. This is the market we will use in the API to obtain the price against the US Dollar. Here’s an [example URL](https://api.pro.coinbase.com/products/BTC-USD/ticker) for Bitcoin.
- **Latest Price** is a currency field using the symbol $ and having a precision of 7 decimals (the max)
- **Latest Price (As Of)** will be a timestamp from when we obtain the pricing. This is a DAte field with the Time value turned on.

## Automation

Next, we will create a custom automation so that we can schedule code to run.

![](https://scotthemmeter.com/hubfs/Imported_Blog_Media/createcustomautomation-3.png)

I am going to name the automation **Get Coin Prices** and the trigger will be “at a scheduled time”. In this sample base, I am setting it to daily, but you can make it happen more often like every few hours.

![](https://scotthemmeter.com/hubfs/Imported_Blog_Media/image-2-2.png)

Our Action will be to Run a script. As long as you setup your table like I showed you up above, you should be able to paste this code into your script. In this code, we are querying the Coins data, looping through each one, and using the [Coinbase Pro API](https://docs.pro.coinbase.com/) (which is free and doesn’t require authentication for price data) to get the market prices.

| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | `let` `updateArray = [];` `// array of records we will be updating at the end`   `// Query the Coins table` `let` `table = base.getTable(` `"Coins"` `);` `let` `query =` `await` `table.selectRecordsAsync({` `    ` `sorts: [ {field:` `"Latest Price (As Of)"` `, direction:` `"asc"` `} ],` `// this helps in case any records error in prior runs. They will be at the top of the next run.` `    ` `fields: [` `"Ticker"` `,` `"Name"` `,` `"Market"` `,` `"Latest Price (As Of)"` `,` `"Latest Price"` `]` `// it's important to name the specific fields you want to pull back.` `});`   `// Loop through the records, one at a time` `for` `(` `let` `record of query.records) {` `    `  `    ` `// Use Fetch() in JavaScript to contact the Coinbase API for the price` `    ` `let` `response =` `await` `fetch('https:` `//api.pro.coinbase.com/products/' + record.getCellValueAsString("Market") + '/ticker');` `    `  `    ` `// This is not critical, but it helps to have an execution log you can look back on later.` `    ` `let` `log = '` `';` `    ` `log += '` `\n` `' + '` `Name:` `' + record.getCellValueAsString("Name");` `    ` `log += '` `\n` `' + '` `Ticker:` `' + record.getCellValueAsString("Ticker");` `    ` `log += '` `\n` `' + '` `Market:` `' + record.getCellValueAsString("Market");` `    ` `log += '` `\n` `' + "Response Status: " + response.status;`   `    ` `if (response.status === 200) { // 200 is a response of OK. That'` `s what we want.`   `        ` `// get the JSON data from the response` `        ` `let` `data =` `await` `response.json();`   `        ` `// make sure we obtained a number for the price and build an update object to update the coin record` `        ` `if` `(isNaN(Number(data.price)) ==` `false` `){` `            ` `let` `updateObject = {};` `            ` `updateObject[` `"id"` `] = record.id;` `            ` `updateObject[` `"fields"` `] = {};` `            ` `updateObject[` `"fields"` `][` `"Latest Price"` `] = Number(data.price);` `            ` `updateObject[` `"fields"` `][` `"Latest Price (As Of)"` `] =` `new` `Date();` `            ` `updateArray.push(updateObject);` `            ` `log +=` `'\n'` `+` `'Price: '` `+ updateObject[` `"fields"` `][` `"Latest Price"` `];` `        ` `}` `    ` `}` `    ` `console.log(log);` `}`   `// Make sure we have records to update and, if so, update them` `if` `(updateArray.length > 0){` `    ` `console.log(updateArray);` `    ` `await` `table.updateRecordsAsync(updateArray);` `}` ` ` |
| --- | --- |

You can run a Test within the code editor. When you do, it should look like this.

![](https://scotthemmeter.com/hubfs/Imported_Blog_Media/image-4-Jul-22-2022-07-01-49-57-PM.png)

After you click the Finish Editing link, don’t forget to turn on your Automation.

![](https://scotthemmeter.com/hubfs/Imported_Blog_Media/image-16-Jul-22-2022-07-01-58-80-PM.png)

## Review Results

As you can see, our table has been populated when we ran our test.

![](https://scotthemmeter.com/hubfs/Imported_Blog_Media/image-19-4.png)

As you can see, we now have a price populated on each record and a timestamp for when we last obtained the price.

## Debugging

As you probably noticed in the image above, we did not get a price for Avalanche (AVAX). Why not? Well, if you go into the Automation, click on the script node and then work your way to the execution logs, you can find out.

![](https://scotthemmeter.com/hubfs/Imported_Blog_Media/image-13-Jul-22-2022-07-01-51-93-PM.png)

The benefit of having some `console.log` lines in your script is that you can review your execution logs and debug your script. As you can see, Avalanche is returning a 404 response rather than a 200. We are using the [Coinbase Pro API](https://docs.pro.coinbase.com/). As it turns out, Coinbase does not support the AVAX coin. Thus, they are not able to obtain a quote for it.

![](https://scotthemmeter.com/hubfs/Imported_Blog_Media/image-15-3.png)

I hope this was a good example for you. All in all, the script was pretty simple, but it needs to get tied into a framework for automating it to run. That is where the scheduled automations from Airtable come into play. Cool stuff.

 

### Share:

[Share on Facebook](http://www.facebook.com/share.php?u=https://scotthemmeter.com/2021/09/28/get-crypto-prices-with-airtable-scripts&utm_medium=social&utm_source=facebook) [Share on LinkedIn](http://www.linkedin.com/shareArticle?mini=true&url=https://scotthemmeter.com/2021/09/28/get-crypto-prices-with-airtable-scripts&utm_medium=social&utm_source=linkedin) [Share on Twitter](https://twitter.com/intent/tweet?original_referer=https://scotthemmeter.com/2021/09/28/get-crypto-prices-with-airtable-scripts&utm_medium=social&utm_source=twitter&url=https://scotthemmeter.com/2021/09/28/get-crypto-prices-with-airtable-scripts&utm_medium=social&utm_source=twitter&source=tweetbutton&text=Get%20Crypto%20Prices%20with%20Airtable%20Scripts)

[Crypto](https://scotthemmeter.com/tag/crypto), [Rollups](https://scotthemmeter.com/tag/rollups), [Automations](https://scotthemmeter.com/tag/automations), [Scripting](https://scotthemmeter.com/tag/scripting), [Airtable](https://scotthemmeter.com/tag/airtable)

## Scott Hemmeter

## Comments

## Related posts

Search [Airtable: Creating a CRM (Part 3) – Opportunities](https://scotthemmeter.com/2021/09/27/airtable-creating-a-crm-part-3-opportunities)

[Airtable: Creating a CRM (Part 4) – Convert the Web Lead](https://scotthemmeter.com/2021/09/30/airtable-creating-a-crm-part-4-convert-the-web-lead) Search

© 2026 All rights reserved.

```json
{
  "@context" : "https://schema.org",
  "@type" : "BlogPosting",
  "author" : {
    "@type" : "Person",
    "name" : "Scott Hemmeter",
    "url" : "https://scotthemmeter.com/author/scott-hemmeter"
  },
  "dateModified" : "2022-08-02T22:41:21.366Z",
  "datePublished" : "2021-09-28T07:00:00.000Z",
  "headline" : "Get Crypto Prices with Airtable Scripts | Scott Hemmeter",
  "image" : [ "https://scotthemmeter.com/hubfs/Imported_Blog_Media/image-4-Jul-22-2022-07-01-53-69-PM.png" ],
  "mainEntityOfPage" : {
    "@id" : "https://scotthemmeter.com/2021/09/28/get-crypto-prices-with-airtable-scripts",
    "@type" : "WebPage"
  },
  "publisher" : {
    "@type" : "Organization",
    "logo" : {
      "@type" : "ImageObject",
      "url" : "https://scotthemmeter.com/hubfs/cropped-logo-1.png"
    },
    "name" : "Scott Hemmeter"
  }
}
```