Попробуйте следующий код скрипта:
function Send_Button() {
//activate the spreadsheet
var spreadsheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
var cellCurrency = spreadsheet.getRange('E10').getValue();
//fatching the data from the API
var res = UrlFetchApp.fetch("https://api.exchangeratesapi.io/latest?base="+cellCurrency).getContentText();
//parsing data to JSON
var json = JSON.parse(res);
//exporting data in variables
var USD=json['rates']['USD'],
CAD=json['rates']['CAD'],
GBP=json['rates']['GBP'],
EUR=json['rates']['EUR'];
//an array to fetch just 4 currencies
var CRN = [USD,CAD,GBP,EUR];
var cellsPrice = spreadsheet.getRange('E5:E8').getValues();
//targeted cell in the second currencies table
var targetRange = spreadsheet.getRange('H3:K6');
var targetValues = targetRange.getValues();
//converting process
for(var i=0;i<cellsPrice.length;i++) {
for(var j=0;j<CRN.length;j++) {
targetValues[i][j] = cellsPrice[i][0]*CRN[j];
}
}
targetRange.setValues(targetValues);
};
Вы также можете получить аналогичный результат, используя функцию GOOGLEFINANCE , попробуйте:
=mmult(E5:E8,{googlefinance("USDEUR"),googlefinance("USDCAD"),googlefinance("USDGBP")})