Skip to content
Discussion options

You must be logged in to vote

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:

=getExchangeRate("USD", "EUR")
=getExchangeRate("GBP", "JPY")
=A2 * getExchangeRate("USD", "EUR")

Auto-refresh: Ra…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by cahthuranag
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant