200 free credits - no credit card required All systems operational · 99.99% uptime  ·  View live status →
Back to blog Guide

Postal Code and House Number in Excel with ApiCheck (Including Coordinates)

Easily enrich your Excel file with coordinates (lat/lon) based on postal code and house number via the ApiCheck API and a Node.js script.

Mark 23 January 2023 2 min read
Postal Code and House Number in Excel with ApiCheck (Including Coordinates)

Do you have an Excel file with postal codes and house numbers and want to add GPS coordinates? With a simple Node.js script and the ApiCheck API, you can do this fully automatically.

What Do You Need?

  • Node.js installed on your computer
  • An ApiCheck API key (create a free account)
  • Your Excel file saved as CSV

Preparing the CSV

Save your Excel file as CSV (delimiter-separated values). Make sure the columns have the following names:

Column name Description
Postcode Dutch postal code (e.g. 1092CX)
Huisnummer House number (e.g. 12)
Toevoeging Optional: addition (e.g. A)

Install the Dependencies

mkdir address-enricher && cd address-enricher
npm init -y
npm install fast-csv request

The Script: index.js

const fs = require('fs');
const csv = require('fast-csv');
const request = require('request');

const API_KEY = 'YOUR_API_KEY_HERE';
const INPUT_FILE = 'adressen.csv';
const OUTPUT_FILE = 'adressen_met_coordinaten.csv';

const rows = [];

fs.createReadStream(INPUT_FILE)
  .pipe(csv.parse({ headers: true }))
  .on('data', row => rows.push(row))
  .on('end', () => processRows(rows));

async function processRows(rows) {
  const results = [];

  for (const row of rows) {
    const { Postcode, Huisnummer, Toevoeging } = row;

    const url = `https://api.apicheck.nl/lookup/v1/address/nl` +
      `?postalcode=${Postcode}&number=${Huisnummer}` +
      `${Toevoeging ? `&numberAddition=${Toevoeging}` : ''}`;

    const data = await fetchAddress(url, API_KEY);

    results.push({
      ...row,
      Straat: data?.street || '',
      Stad: data?.city || '',
      Latitude: data?.location?.coordinates?.latitude || '',
      Longitude: data?.location?.coordinates?.longitude || '',
    });

    // Brief pause to avoid rate limiting
    await new Promise(resolve => setTimeout(resolve, 50));
  }

  csv.writeToPath(OUTPUT_FILE, results, { headers: true })
    .on('finish', () => console.log(`Done! Results saved to ${OUTPUT_FILE}`));
}

function fetchAddress(url, apiKey) {
  return new Promise((resolve) => {
    request({ url, headers: { 'X-api-key': apiKey }, json: true },
      (err, res, body) => resolve(err ? null : body)
    );
  });
}

Running the Script

node index.js

The script processes all rows and writes a new CSV file with the extra columns Straat, Stad, Latitude, and Longitude.

Opening the Result in Excel

Open the output CSV file in Excel. You now have GPS coordinates (WGS 84) for each address — ready to use for map visualization, route planning, or geographic analyses.

Working with Large Files

Processing thousands of addresses? Increase the pause between calls (setTimeout) or use an API key with higher rate limits. Contact [email protected] for enterprise options.