How to integrate exchange rates in Google Sheets? #8
-
|
I want to pull live exchange rates directly into a Google Sheets spreadsheet. Is that possible? AnswerYes. You can use Google Apps Script with the Exchange Rate API. Step 1: Open your Google Sheet, go to Extensions > Apps Script Step 2: Paste this function: function getExchangeRate(from, to) {
const apiKey = 'era_live_YOUR_KEY';
const url = `https://exchange-rateapi.com/api/rate?source=${from}&target=${to}`;
const options = {
headers: { 'Authorization': `Bearer ${apiKey}` },
muteHttpExceptions: true,
};
const response = UrlFetchApp.fetch(url, options);
const data = JSON.parse(response.getContentText());
return data[0].rate;
}Step 3: Use it in any cell: Auto-refresh: Rates update when you open the sheet or manually refresh. For automatic periodic refresh, add a time-driven trigger in Apps Script. Get your API key: exchange-rateapi.com/register |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
Yes. You can use Google Apps Script with the Exchange Rate API. Step 1: Open your Google Sheet, go to Extensions > Apps Script Step 2: Paste this function: function getExchangeRate(from, to) {
const apiKey = 'era_live_YOUR_KEY';
const url = `https://exchange-rateapi.com/api/rate?source=${from}&target=${to}`;
const options = {
headers: { 'Authorization': `Bearer ${apiKey}` },
muteHttpExceptions: true,
};
const response = UrlFetchApp.fetch(url, options);
const data = JSON.parse(response.getContentText());
return data[0].rate;
}Step 3: Use it in any cell: Auto-refresh: Rates update when you open the sheet or manually refresh. For automatic periodic refresh, add a time-driven trigger in Apps Script. Get your API key: exchange-rateapi.com/register |
Beta Was this translation helpful? Give feedback.
Yes. You can use Google Apps Script with the Exchange Rate API.
Step 1: Open your Google Sheet, go to Extensions > Apps Script
Step 2: Paste this function:
Step 3: Use it in any cell:
Auto-refresh: Ra…