1

PHOTO EMBED

Fri Apr 15 2022 11:44:30 GMT+0000 (Coordinated Universal Time)

Saved by @Mariam_isp

// Change this to the name of a table in your base
let table = base.getTable('Invoices');
// Fetch conversion rate from API - you could change this to any API you want
let apiResponse = await fetch('https://api.exchangerate.host/latest?base=USD');
let data = await apiResponse.json();
let conversionRate = data.rates.GBP;
console.log(`Conversion rate: ${conversionRate}`);
// Update all the records
let result = await table.selectRecordsAsync();
for (let record of result.records) {
    await table.updateRecordAsync(record, {
        // Change these names to fields in your base
        'Amount (GBP)': record.getCellValue('Amount (USD)') * conversionRate,
    });
}
content_copyCOPY

lalala