Scripting
Example

Currency converter

This script uses an external API to convert between currencies in your base. You can adapt it to different currencies, or use it as a starting point for a different API integration.

Example
// 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({fields: ['Amount (USD)']});
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,
});
}