Airtable Integration
Build powerful oil price tracking databases in Airtable. Combine the flexibility of a spreadsheet with the power of a database to track, analyze, and share commodity price data across your organization.
Overview
Airtable provides a flexible database platform that's perfect for tracking oil prices over time. Combined with OilPriceAPI, you can create automated price tracking systems, historical databases, and custom reporting dashboards without writing code.
What You Can Build:
- Historical oil price databases
- Price comparison trackers
- Automated daily price logs
- Team-accessible commodity dashboards
- Price alert and notification systems
- Custom reporting and analysis tools
Prerequisites
Before you begin:
- An active OilPriceAPI account with API key (Sign up)
- An Airtable account (Create free account)
- A connector tool: Zapier, Make, or Airtable Automations with Scripts
Method 1: Airtable Automations with Scripts
Airtable's built-in automations can run scripts to fetch oil prices directly.
Step 1: Create Your Oil Price Base
- Create a new Airtable base
- Name it "Oil Price Tracker"
- Create a table with these fields:
| Field Name | Field Type | Description |
|---|---|---|
| Date | Date | Date of price record |
| Commodity | Single Select | BRENT_CRUDE_USD, WTI_USD, etc. |
| Price | Currency | Price per barrel |
| Change | Percent | Daily change percentage |
| Updated At | Date/Time | Timestamp from API |
| Record ID | Autonumber | Unique identifier |
Step 2: Create an Automation
- Go to Automations in your base
- Click Create automation
- Name it "Daily Oil Price Import"
Step 3: Set the Trigger
- Choose At a scheduled time
- Configure:
- Frequency: Daily
- Time: 8:00 AM (or your preferred time)
- Timezone: Your timezone
Step 4: Add a Script Action
- Add action: Run a script
- Paste this script:
// Airtable Automation Script: Fetch Oil Prices
let settings = input.config({
title: "OilPriceAPI Settings",
description: "Configure your API connection",
items: [
input.config.text("apiKey", {
label: "API Key",
description: "Your OilPriceAPI key"
}),
input.config.text("commodities", {
label: "Commodity Codes",
description: "Comma-separated codes",
defaultValue: "BRENT_CRUDE_USD,WTI_USD,NATURAL_GAS_USD"
})
]
});
// Fetch prices from OilPriceAPI
let response = await fetch(
`https://api.oilpriceapi.com/v1/prices/latest?by_code=${settings.commodities}`,
{
headers: {
"Authorization": `Token ${settings.apiKey}`,
"Content-Type": "application/json"
}
}
);
if (!response.ok) {
throw new Error(`API request failed: ${response.status}`);
}
let data = await response.json();
// Get the target table
let table = base.getTable("Oil Prices");
// Create records for each commodity
let recordsToCreate = [];
for (let item of data.data.items) {
recordsToCreate.push({
fields: {
"Date": new Date().toISOString().split('T')[0],
"Commodity": item.code,
"Price": item.price,
"Change": item.change_percent / 100,
"Updated At": item.updated_at
}
});
}
// Insert records
await table.createRecordsAsync(recordsToCreate);
output.text(`Successfully imported ${recordsToCreate.length} price records`);
Step 5: Configure and Test
- Click Test script to verify it works
- Review created records in your table
- Toggle automation ON
Method 2: Integration via Zapier
Connect OilPriceAPI to Airtable using Zapier for a code-free approach.
Step 1: Prepare Your Airtable Base
Create a base with the same field structure as Method 1.
Step 2: Create a Zapier Zap
Trigger: Schedule by Zapier
- Choose frequency (daily, hourly)
Action 1: Webhooks by Zapier (GET)
- URL:
https://api.oilpriceapi.com/v1/prices/latest?by_code=BRENT_CRUDE_USD - Headers:
Authorization: Token YOUR_API_KEY
- URL:
Action 2: Airtable (Create Record)
- Base: Oil Price Tracker
- Table: Oil Prices
- Map fields from API response
Step 3: Handle Multiple Commodities
For multiple commodities, add a Looping by Zapier action:
- After the API call, add Looping by Zapier
- Loop through:
{{data.items}} - Inside the loop, add Airtable Create Record
Method 3: Integration via Make
Build visual workflows to sync OilPriceAPI with Airtable.
Scenario Setup
[Scheduler] → [HTTP Module] → [JSON Parse] → [Iterator] → [Airtable: Create Record]
Configuration
HTTP Module:
- URL:
https://api.oilpriceapi.com/v1/prices/latest - Headers: Authorization with your API key
- URL:
Iterator:
- Array:
{{1.data.items}}
- Array:
Airtable Module:
- Connection: Your Airtable account
- Base: Oil Price Tracker
- Table: Oil Prices
- Map iterator values to fields
Building Your Oil Price Dashboard
View 1: Grid View (Default)
Your standard table view showing all records. Configure:
- Sort by Date (descending) to see latest prices first
- Group by Commodity for organized viewing
View 2: Calendar View
Track prices over time:
- Create new Calendar view
- Set Date field as the calendar date
- See price records plotted on the calendar
View 3: Gallery View
Create price cards:
- Create Gallery view
- Configure card layout to show key metrics
- Add cover images for each commodity
View 4: Chart Extension
Visualize price trends:
- Add the Chart extension
- Create line chart:
- X-axis: Date
- Y-axis: Price
- Group by: Commodity
- See historical trends at a glance
Use Case Templates
Template 1: Weekly Commodity Report
Base Structure:
- Table: Weekly Prices
- Fields: Week Start Date, Week End Date, Commodity, Open, High, Low, Close, Weekly Change
Automation:
- Runs every Monday
- Aggregates previous week's daily prices
- Calculates high, low, and change
Template 2: Price Alert Tracker
Base Structure:
- Table: Alerts
- Fields: Alert Name, Commodity, Threshold Type (Above/Below), Threshold Price, Status, Last Triggered
Automation:
- Fetch prices hourly
- Compare against alert thresholds
- Update status and send notifications
Template 3: Multi-Commodity Comparison
Base Structure:
- Table: Daily Snapshot
- Fields: Date, Brent Price, WTI Price, Spread, Natural Gas, Diesel
View Configuration:
- Create charts showing spread between Brent and WTI
- Track correlations between commodities
Template 4: Fuel Cost Calculator
Base Structure:
- Table: Cost Calculations
- Fields: Date, Diesel Price, Fleet Size, Daily Consumption, Daily Fuel Cost, Monthly Estimate
Formula Fields:
Daily Fuel Cost = {Diesel Price} * {Daily Consumption}
Monthly Estimate = {Daily Fuel Cost} * 22
Advanced Airtable Features
Linked Records
Connect price data to other business data:
- Create a "Suppliers" table
- Link price records to supplier contracts
- Track cost implications automatically
Rollup Fields
Aggregate data across linked records:
- Calculate average price per supplier
- Sum total costs by period
- Count records by commodity type
Lookup Fields
Pull data from linked records:
- Show current price on contract records
- Display commodity details on transaction records
Formula Examples
// Calculate percentage change
IF({Previous Price},
ROUND((({Price} - {Previous Price}) / {Previous Price}) * 100, 2),
"N/A"
)
// Format price with currency
CONCATENATE("$", ROUND({Price}, 2), " USD")
// Days since update
DATETIME_DIFF(NOW(), {Updated At}, 'days')
Sharing and Collaboration
Share with Team
- Click Share in your base
- Invite team members with appropriate permissions:
- Creator: Full access
- Editor: Can edit records
- Commenter: Can comment only
- Read only: View access
Public Dashboards
Create public views for stakeholders:
- Create a filtered view
- Click Share view
- Generate public link
- Embed in internal sites or share externally
Sync to Other Tools
Use Airtable's sync feature:
- Sync to other Airtable bases
- Connect to BI tools via API
- Export to CSV for reporting
Troubleshooting
Records Not Creating
- Verify Airtable field types match API data types
- Check automation/Zap execution history
- Ensure API key has required permissions
Duplicate Records
- Add a unique identifier formula field
- Use "Find Record" before creating new ones
- Set up deduplication automation
Script Errors
- Check API key is entered correctly in settings
- Verify commodity codes are valid
- Review Airtable's automation logs
FAQ
Can I use Airtable's free plan for oil price tracking?
Yes, Airtable's free plan supports automations and scripts. You're limited to 100 automation runs per month. For daily updates to one table, this covers about 3 months of usage.
How much historical data can I store?
Airtable's free plan allows 1,000 records per base. Pro plans offer up to 50,000 records. For long-term historical data, consider archiving older records or upgrading your plan.
Can I import historical oil prices?
Yes. Use the OilPriceAPI historical endpoint (/v1/prices/past_week or /v1/prices/past_day) and run a one-time import script to backfill your database.
How do I share price data with my team?
Use Airtable's sharing features to invite team members. Create specific views for different audiences and control permissions for each user.
Can I create charts and visualizations?
Yes. Use Airtable's Chart extension to create line charts, bar charts, and other visualizations directly in your base. For advanced analytics, export to Google Sheets or BI tools.