By the end of this tutorial you will have a Python script that pulls Swedish companies from allabolag.se into structured rows: organisation number, name, revenue, profit, employee count, industry, website and contact fields. Allabolag publishes public company data for Sweden, and Allabolag Scraper (reventadata/allabolag-scraper) is the Apify Actor that reads it. You give it a keyword, and it returns one row per company.
The sample rows in this guide come from one run on 17 November 2026 that searched bygg (Swedish for building or construction) in industry search and collected 10 companies. They are copied from that run's dataset, not written by hand. The Actor is not affiliated with allabolag.se.
Prerequisites
You need three things:
- Python 3.11 or newer. The Apify client documentation gives Python 3.11 as the minimum.
- A free Apify account, which you can create with an email address or a GitHub login.
- Your API token from your Apify account.
Install the client and export the token:
pip install -U "apify-client~=3.0" export APIFY_API_TOKEN="your_apify_token_here" No scraping code is needed on your side, and you do not need an allabolag.se account. The Actor reads public pages without a login.
What you'll achieve
You will run one industry search for bygg from Python, read the 10 rows back and print two lines per company. The first line gives the name, the town, the revenue and the employee count. The second gives the industry, the organisation number and the website. You will also see which fields are empty in this run.
The same script works for a sales team that needs a list of companies in one industry, or for an analyst who wants revenue and staff side by side. Only the input changes. Your results can differ from the sample rows below.
Step 1: Open Allabolag Scraper
Open the Allabolag Scraper page on Apify Store. This tutorial calls the Actor from Python, so the name you need is reventadata/allabolag-scraper.
Step 2: Choose the search
The input has five fields that shape a search:
-
searchQuery: a keyword for companies or industries. The default isbygg. An empty value makes the run FAIL with a message. -
searchType:industry(the default) reads results page by page, up to 400 pages.companyNamelooks up a company name and reads page 1 only. Any other value is rejected. -
sortBy:relevance(the default),revenueAsc,revenueDescornumEmployeesDesc. It applies to industry search. Any other value is rejected. -
maxItems: how many companies to collect, from 1 to 10,000. The default is 100. -
maxPages: how many result pages to read, from 1 to 400. Each page holds up to 25 companies. The default is 20.
The input of the run behind the sample is below. It also had one more input field, which this guide leaves out because the run used its default value. With maxPages at 1, the search reads a single page, so the sample is capped at 10 companies by maxItems.
{ "searchQuery": "bygg", "searchType": "industry", "sortBy": "relevance", "maxItems": 10, "maxPages": 1 } Step 3: Run it from Python
This script starts the Actor, waits for it, reads the dataset and prints two lines per company:
import os from apify_client import ApifyClient # 1. Initialise the client with your token from the environment client = ApifyClient(os.environ["APIFY_API_TOKEN"]) # 2. Describe the search: industry search for "bygg", relevance order, 10 companies run_input = { "searchQuery": "bygg", "searchType": "industry", "sortBy": "relevance", "maxItems": 10, "maxPages": 1, } # 3. Start the Actor and wait for it to finish run = client.actor("reventadata/allabolag-scraper").call(run_input=run_input) if run is None or run.status != "SUCCEEDED": status = run.status if run else "unknown" raise SystemExit(f"Run did not succeed (status: {status}).") # 4. Read the rows from the run's default dataset items = client.dataset(run.default_dataset_id).list_items().items print(f"Retrieved {len(items)} companies.\n") # 5. Print two lines per company: name and town, revenue and staff, then industry and contact for item in items: revenue, employees = item.get("revenueTsek"), item.get("employees") print(f"{item.get('name')}, {item.get('visitorPostPlace')} | revenue {revenue} TSEK | {employees} employees") print(f" {item.get('currentIndustryName')}, org number {item.get('orgnr')}, {item.get('homePage')}") Keep maxPages at 1 while you test, so each run reads a single page.
Step 4: Read the output
The script prints this for the 10 rows of the run:
Retrieved 10 companies. Aceve Sverige AB, Stockholm | revenue 180010 TSEK | 123 employees Datakonsulter, org number 5569442501, https://www.aceve.com Vägfas AB, Norrtälje | revenue 12765 TSEK | 10 employees Datautveckling, systemutveckling, programutveckling, org number 5566322938, https://vagfas.se Hans Ahlman Pool & Konsult AB, Bjärred | revenue 4483 TSEK | 2 employees Swimming-, bubbelpooler, SPA-utrustning, org number 5567921720, None Sandströms Schakt AB, Umeå | revenue 4965 TSEK | 4 employees Markentreprenörer, anläggningsentreprenörer, org number 5562226042, http://www.sandstromsschakt.com/ Alviks Byggentreprenad AB, Alnö | revenue 1241 TSEK | 2 employees Byggmästare, org number 5592665094, None Veidekke Entreprenad AB, Solna | revenue 6122276 TSEK | 1185 employees Byggentreprenader-Infrastruktur, org number 5565086583, https://www.veidekke.se/ Pexymek AB, Falkenberg | revenue 40750 TSEK | 15 employees Legoarbeten, org number 5561256354, http://www.pexymek.se Edelkrantz Bygg & Plattsättning AB, Hägersten | revenue 40633 TSEK | 15 employees Byggmästare, org number 5590170303, https://www.edelkrantz.se/ Göteborgs Industriinstallation AB, None | revenue 36117 TSEK | 17 employees Industriellt underhåll, org number 5568757131, https://giab.eu/ DSAB Svetsteknik AB, Nyköping | revenue 17681 TSEK | 9 employees Byggmästare, org number 5590011150, https://www.dsabsvetsteknik.se/sv/ Several things are visible in these rows:
- Revenue and profit are in thousands of SEK (
revenueTsek,profitTsek). Veidekke Entreprenad AB's 6122276 is about 6.1 billion SEK. - Two rows have a negative profit: Hans Ahlman Pool & Konsult AB (-133) and Alviks Byggentreprenad AB (-117).
- In this run,
phone2,mobileandmobile2are empty on all 10 rows. -
emailis empty on 5 rows,homePageon 2 rows andphoneon 1 row. - Göteborgs Industriinstallation AB has no visitor town, zip code, county or municipality in this run.
Step 5: Look at one full row
This is the first company of the run, with the industries list cut to its first two entries. Two fields are left out of this sample.
{ "orgnr": "5569442501", "name": "Aceve Sverige AB", "legalName": "Aceve Sverige AB", "companyId": "2K3WHC5I5YDMJ", "phone": null, "phone2": null, "mobile": null, "mobile2": null, "email": null, "homePage": "https://www.aceve.com", "visitorAddressLine": "Torsgatan 11", "visitorZipCode": "111 23", "visitorPostPlace": "Stockholm", "postalAddressLine": "Torsgatan 11", "postalZipCode": "111 23", "postalPostPlace": "Stockholm", "county": "Stockholm", "municipality": "Stockholm", "countryPart": "Hela Sverige", "revenueTsek": 180010, "profitTsek": 3932, "currency": "SEK", "employees": 123, "companyAccountsLastUpdatedDate": "2024-12", "contactPersonName": "Claus Thorsgaard", "contactPersonRole": "Ledamot", "contactPersonType": "Person", "currentIndustryCode": "10002043", "currentIndustryName": "Datakonsulter", "currentIndustryDescription": "Aceve: Projekverktyg och affärssystem för bygg och installation.", "industries": [ { "code": "10002043", "name": "Datakonsulter" }, { "code": "10002017", "name": "Data/IT-konsulter . Branschspecialister" } ], "marketingProtection": false, "description": "Aceve: Projekverktyg och affärssystem för bygg och installation.", "customerId": "2190835", "listingId": "3575654", "url": "https://www.allabolag.se/foretag/aceve-sverige-ab/stockholm/datakonsulter/2K3WHC5I5YDMJ" } The url field is the company's profile page on allabolag.se.
Understanding your results
Each row has the same set of fields. The ones you will use most:
-
orgnr: the Swedish organisation number, as text. The Actor does not push the sameorgnrtwice in one run. -
nameandlegalName: the company name and the registered legal name. They match on 8 of the 10 rows. -
revenueTsekandprofitTsek: revenue and profit in thousands of SEK. Profit can be negative. -
employees: the registered number of employees. All 10 rows carry a number. -
companyAccountsLastUpdatedDate: the year and month of the latest financial report, asYYYY-MM. In this run the dates run from 2024-12 to 2026-06. -
contactPersonNameandcontactPersonRole: the executive or board member the site lists, and the role as the site writes it, for exampleLedamot. -
currentIndustryNameandindustries: the primary industry, and every registered industry code and name. -
marketingProtection:falseon all 10 rows in this run.
Pro tips
- Test with
maxPagesset to 1. One page holds up to 25 companies, enough to check the fields. - Sort by size when you want the highest first.
revenueDescandnumEmployeesDescorder industry results by revenue and by employees. - Check for empty fields before you use them. In this run
homePage,emailandphoneare sometimesNone, so test each one before you use it. - Set
maxItemsto the number you need. The run stops once it has pushed that many rows. - Use
companyNamefor one exact name. It reads page 1 only, so it is a lookup rather than a sweep.
Troubleshooting
- FAILED with "searchQuery cannot be empty". An empty keyword ends the run with the message
0 results: searchQuery cannot be empty. Fix the input and run again.Fill in the keyword and run again. - SUCCEEDED with zero rows. The site answered and nothing matched. The status message says so. Try a broader keyword.
- FAILED with pages that could not be read. If a page could not be read and the run saved no rows, the run fails, because the missing page may have held matches.
- Fewer rows than you asked for. The log lists
Skipped Nlines with a reason, such as a company already pushed under the same organisation number, and it ends withPushed N row(s). - The run stopped early for time. Rows already pushed are kept, and the log warns that the sweep ended early.
Next steps
To try another search, change searchQuery or searchType and run again. The Python client reference describes the page that list_items() returns, with its items list: https://docs.apify.com/api/client/python/reference/class/DatasetItemsPage
The rows hold contact names and phone numbers that companies publish. Check that your use complies with the data-protection rules that apply to you.
For current pricing and details, see the Store page.
What search will you try first? Drop a comment below.
About the author: reventadata builds and publishes data extraction Actors on the Apify Store.