Automatically converts currency values from a source currency to a target currency using Open Exchange Rates API with support for historical exchange rates.
Parameter | Type | Description |
---|---|---|
sheetSlug | string | The slug of the sheet the plugin should operate on |
sourceCurrency | string | The three-letter currency code (e.g., “USD”) of the source amounts |
targetCurrency | string | The three-letter currency code (e.g., “EUR”) to convert the amounts to |
amountField | string | The field key/slug that contains the numerical amount to be converted |
convertedAmountField | string | The field key/slug where the converted amount will be stored |
Parameter | Type | Description | Default Behavior |
---|---|---|---|
dateField | string | The field key/slug containing the date (in YYYY-MM-DD format) for fetching historical exchange rates | Uses current date to fetch latest exchange rates |
exchangeRateField | string | The field key/slug where the calculated exchange rate for the conversion will be stored | Exchange rate is not stored on the record |
conversionDateField | string | The field key/slug where the timestamp of the conversion will be stored in ISO format | Conversion date is not stored on the record |
Error | Cause | Solution |
---|---|---|
”Invalid source/target currency” | Currency codes are not valid three-letter codes | Check that currency codes are valid and supported by the API |
”Network error” or “Status: 401” | API key issues | Verify OPENEXCHANGERATES_API_KEY is correct and not expired |
”Amount must be a valid number” | Invalid amount data | Ensure amount field contains numeric values |
”Invalid date format” | Date not in YYYY-MM-DD format | Ensure date field uses YYYY-MM-DD format |
record.addError(fieldName, message)
record.addError('general', message)
OPENEXCHANGERATES_API_KEY
environment variable must be set in your Flatfile Space with your API keydateField
must contain dates in YYYY-MM-DD
format onlydateField
is not provided, the plugin uses the current date to fetch the latest exchange ratesexchangeRateField
is not provided, the calculated exchange rate is not stored on the recordconversionDateField
is not provided, the conversion timestamp is not stored on the record