Skip to content
N1
Integrations · exchange rates · Excel

An import cost calculator with live exchange rates and Excel export

Client: Import and wholesale, NDA Category: Integrations Stack: JavaScript, SheetJS (xlsx), PHP (curl_multi), exchange rate API, HTML/CSS Timeline: about 4 weeks
Problem

The cost of imported goods was calculated in a spreadsheet by hand: exchange rates were copied from websites, and delivery, duty and markup were estimated for each item separately. One formula error — and the sales team got the wrong price.

Constraints

Suppliers price in dollars, euros, rubles and yuan, but the calculation has to be in tenge; the external rate service may not respond, and its access key must not be exposed to the browser.

What I did
  • Item cards: price, currency (USD, EUR, RUB, CNY) and quantity; all amounts recalculate instantly on any change
  • Delivery defaults to 6% of the goods amount and can be entered manually in euros when needed
  • The calculation chain: duty, additional costs, overhead contribution, trade markup, price excluding VAT and the manager bonus — in blocks for the administrator and the sales team
  • Rates of four currencies to tenge — parallel requests (curl_multi) through a PHP proxy, so the API key stays on the server; ruble and yuan via a cross rate through the dollar
  • Three attempts to fetch rates with a pause; on failure — default values and manual editing of any rate
  • Exporting the calculation to .xlsx via SheetJS: a formatted table with amounts in tenge and the cost of each item
Architecture
Item form (JS) → PHP rate proxy (curl_multi) → Exchange rate API → Cost calculation → .xlsx export (SheetJS)
Result

Cost and selling price for each item are visible as soon as they are entered: rates load automatically, and the finished calculation is exported to Excel with one button. The calculator was released in March 2025.

What can be reused
Parallel rate loading via curl_multi with cross rates Retries with fallback to manual input Browser-side export of a tabular calculation to .xlsx