ARCNAUTICAL Voyage APIAPI docsSign in

Sea distances in Excel

Type two ports and a date. The row fills itself: the distance, the route container ships were taking that month, the distance by Suez and by the Cape of Good Hope, and CO₂e for the weight.

Make your link (free account)

There are three ways, easiest first. All of them use one link that you make once, signed in. The link can only answer distances, routes and CO₂e. It is not an API key, and you can turn it off.

1. The workbook, with no code

  1. Sign in and open Freight Carbon. Go to “In your own spreadsheet” and choose “Make the link”.
  2. Choose “Download the workbook” and open it in Excel. If a yellow bar appears, choose Enable Content.
  3. Type From, To, the sailing date and the cargo in tonnes. Copy the row down for more.
FromToBy Suez, nmBy the Cape, nmThe Cape adds
ShanghaiRotterdam10,62314,08533%
SingaporeRotterdam8,45211,91941%
Nhava ShevaLondon Gateway6,35610,79770%
Ho Chi Minh CityFelixstowe8,98812,45439%

Container ships mostly went by the Cape from January 2024 until the autumn of 2026. A distance read off the shortest route understates those years, so the workbook chooses by the month of sailing.

2. One formula in your own sheet

With the port of loading in A2, the port of discharge in B2 and the sailing date in C2. Replace YOUR-LINK with yours; the page where you made it writes the formula for you. It gives text, so a mistake is said in the cell; put it in VALUE() to add it up.

=WEBSERVICE("https://arcnautical.com/sheet/YOUR-LINK/nm?from="&ENCODEURL(A2)&"&to="&ENCODEURL(B2)&"&date="&INT(C2))
Instead of nmYou get
kmKilometres, by the way ships were going that month
routeSuez, Cape or Direct
suez_nm, cape_nmNautical miles by either way, where a lane has the choice
uk_kg, eu_kgkg CO₂e for a container ship, by the UK government average or by EU verified ship records. Add &t=20 for 20 tonnes
rowAll of it at once, as XML for FILTERXML. The workbook asks this way, once a row

Add &via=Colombo for a transshipment port. WEBSERVICE and ENCODEURL are in Excel for Windows, 2013 and later.

3. A macro, if you want one

For Windows. In Excel press Alt+F11, choose Insert, Module, and paste this. Then in a cell: =SEADISTANCE("YOUR-LINK","nm",A2,B2,C2).

Function SeaDistance(yourLink, what, fromPort, toPort, sailing)
    Dim http, url, answer
    url = "https://arcnautical.com/sheet/" & yourLink & "/" & what _
        & "?from=" & Application.WorksheetFunction.EncodeURL(fromPort & "") _
        & "&to=" & Application.WorksheetFunction.EncodeURL(toPort & "")
    If IsDate(sailing) Then url = url & "&date=" & CLng(CDate(sailing))
    url = url & "&wait=20"
    Set http = CreateObject("WinHttp.WinHttpRequest.5.1")
    http.SetTimeouts 5000, 5000, 5000, 30000
    http.Open "GET", url, False
    http.Send
    answer = http.ResponseText
    If http.Status = 200 And IsNumeric(answer) Then
        SeaDistance = CDbl(answer)
    Else
        SeaDistance = answer
    End If
End Function

The link is in the workbook, so anyone you send it to can ask for distances with it. Do not put an API key in a workbook: a key opens your whole account.

From a program

Use an API key and POST /api/v1/voyage-assessments. Ports are UN/LOCODEs: resolve a name first with GET /api/v1/ports?query=rotterdam, which needs no key.

curl -X POST https://arcnautical.com/api/v1/voyage-assessments \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Idempotency-Key: lane-INNSA-NLRTM-001" \
  -H "Content-Type: application/json" \
  -d '{"route":{"origin":"INNSA","destination":"NLRTM"},"include_geometry":false}'

The distance is route.distance_nm. Where a lane can go either way round Africa, alternatives carries the other one. An assessment is also a risk score and is counted against the key’s allowance; a distance on its own is better asked through the link above. Full contract: API docs.

What the distance is

A whole shipment list at once, with the sources for an auditor: upload it in Freight Carbon.