Skip to main content

Working with Excel data from CVR in Nushell

Submitted by Lennart on

First, I did a search on cvr's own website.

Under the search results, there was an option to download them as an xlsx file. Better known as an Excel sheet.

Fortunately, I don't have to work with the sheet in Excel. I have a much better and more powerful tool in Nushell.

Because Nushell speaks fluent xlsx. Just like Nushell speaks json and many other data formats.

So I could just do the following

open CVRudtræk_2025-11-05_Humlebæk.xlsx

And I get a nice overview back.

But to make the data more accessible for further work, I make the command a little longer


open CVRudtræk_2025-11-05_Humlebæk.xlsx | get Virksomhed | transpose | reject column0 | transpose -r

Then we get something like:


╭────┬───────────────────────┬────────────┬────────────┬──────────────────────────────┬─────╮
│  # │ CVR-nummer/REG-nummer │ Startdato  │ Ophørsdato │             Navn             │ ... │
├────┼───────────────────────┼────────────┼────────────┼──────────────────────────────┼─────┤
│  0 │ 30911520              │ 2007-10-09 │            │ HUMLEBÆK CENTER A/S          │ ... │
│  1 │ 39885263              │ 2018-09-21 │            │ Hemming & Nystrup-Larsen A/S │ ... │
│  2 │ 25388224              │ 2000-05-20 │            │ ALS DENMARK A/S              │ ... │
│  3 │ 26482070              │ 2002-02-19 │            │ NORTEC-CANNON A/S            │ ... │
│  4 │ 19042901              │ 1995-09-11 │            │ NIELS E. BORG (D.K.) A/S     │ ... │
│  5 │ 30003926              │ 2006-11-10 │            │ PERNILLE THIELE HOLDING A/S  │ ... │
│  6 │ 19675084              │ 1997-03-07 │            │ AAP HOLDING A/S              │ ... │
│  7 │ 25679911              │ 2000-09-22 │            │ ALCO-METAL HOLDING A/S       │ ... │
│  8 │ 69749917              │ 1957-09-04 │            │ COLOPLAST A/S                │ ... │
│  9 │ 34202818              │ 2012-01-01 │            │ REOLER A/S                   │ ... │
│ 10 │ 76301328              │ 1984-10-24 │            │ ANDERTECH A/S                │ ... │
│ 11 │ 41889675              │ 2020-11-27 │            │ Planetary Impact Ventures    │ ... │  

There is not room for all columns above, but you easily get them like this:

: open CVRudtræk_2025-11-05_Humlebæk.xlsx | get Virksomhed | transpose | reject column0 | transpose -r | columns
╭────┬───────────────────────╮
│  0 │ CVR-nummer/REG-nummer │
│  1 │ Startdato             │
│  2 │ Ophørsdato            │
│  3 │ Navn                  │
│  4 │ Adresse               │
│  5 │ Postnr.               │
│  6 │ By                    │
│  7 │ Virksomhedsform       │
│  8 │ Hovedbranche          │
│  9 │ Telefonnr             │
│ 10 │ Email                 │
│ 11 │ Reklamebeskyttet      │
╰────┴───────────────────────╯
  

Since my plan is to contact these companies for sales purposes, I should first limit my results to the companies that have not chosen to be protected from advertising:

open CVRudtræk_2025-11-05_Humlebæk.xlsx | get Virksomhed | transpose | reject column0 | transpose -r  | where Reklamebeskyttet == Nej

And presto. I have a list of companies I can contact.

That was the easy part :D