Wikipedia Table Extractor
Pricing
from $0.50 / 1,000 results
Go to Apify Store

Wikipedia Table Extractor
Extract structured data from Wikipedia tables as clean JSON. Supports all languages, multiple tables and header detection. Ideal for AI training data and research.
Pricing
from $0.50 / 1,000 results
Rating
0.0
(0)
Developer
Muhammad Naufal
Maintained by CommunityActor stats
0
Bookmarked
2
Total users
0
Monthly active users
19 hours ago
Last modified
Categories
Share
π Wikipedia Data Scraper
Extract tables from any Wikipedia page as clean JSON. Supports wikitable, infobox, sortable, and various Wikipedia table layouts.
Features
- Table extraction β wikitable, infobox, sortable, toccolours, plain tables
- colspan/rowspan β merged cells properly replicated (incl. multi-column rowspans)
- 2-row thead headers β group + subheader rows merged (
subheader (group)), with correct handling for both group-on-bottom (labels under columns) and group-on-top (coarse group row above the real column names) layouts - Row-header tables β tables without a header row whose data rows lead with
<th>(e.g.Country | US | Canada) get the leading<th>as the column name plus positionalcol1..colN - Clean cell text β footnote/citation markers (
[1]), edit links, "citation needed" tags, and<abbr>stripped from values (abbr titles preserved:<abbr title="United States">US</abbr>βUnited States);<br>word-splits in headers/cells keep their space (Total<br>in km2βTotal in km2) - Sortable tables β human-readable display text kept; raw sort key exposed as
{key}_sortValue(dict) or parallel_sortValuesarray (array format) - Image-only cells β X/check icon cells fall back to
data-sort-valueorimg[alt]text - Multi-language β relative links resolve against the page's own origin (fr.wikipedia.org stays on fr.wikipedia.org); bare article titles / mobile URLs (
m.wikipedia.org) auto-normalized toen.wikipedia.org - Page metadata β categories, short description, last-modified, infobox key-values, and accurate page stats (edit count, page length, creator, latest editor, watchers) pulled from Wikipedia's page-info page
- Identity metadata β pageId, revisionId, wikidataId, canonicalTitle, namespaceName, pageName, protectionLevel, lastEditor, language
- Page classification β
isRedirect(+redirectedFrom),isDisambiguation,isStubflags - Section context β nearest h2/h3 heading for each table
- Link extraction β href links from anchor elements within cells (footnote/anchor links filtered out)
- Multiple tables β extract one or all tables on a page
- Dict or array β column-header keys or positional col0/col1 format
Sample output
{"page": "https://en.wikipedia.org/wiki/List_of_largest_companies_by_revenue","title": "List of largest companies by revenue - Wikipedia","tablesFound": 3,"totalRows": 5,"metadata": {"categories": ["Lists of companies by revenue", "Economic lists"],"description": "Wikimedia list article","pageId": "27453603","wikidataId": "Q918765","sitelinksCount": 38,"talkPageUrl": "https://en.wikipedia.org/wiki/Talk:List_of_largest_companies_by_revenue","editCount": "15699","contributorsCount": "412","lastEdited": "2026-07-28T09:14:22Z"},"tables": [{"tableIndex": 0,"tableType": "data","section": "2024 list","headers": ["rank", "company", "country"],"count": 5,"rows": [{"_rowNumber": 1, "rank": "1", "company": "Walmart", "country": "United States", "url": "https://en.wikipedia.org/wiki/List_of_largest_companies_by_revenue"},{"_rowNumber": 2, "rank": "2", "company": "Saudi Aramco", "country": "Saudi Arabia", "url": "https://en.wikipedia.org/wiki/List_of_largest_companies_by_revenue"}]}]}
Input
| Field | Type | Default | Description |
|---|---|---|---|
pageUrl | string | List of largest companies | Full Wikipedia URL (bare article titles and m.wikipedia.org links also accepted) |
tableIndex | integer | 0 | Which table (0 = first) |
maxResults | integer | 20 | Max rows per table |
outputFormat | string | dict | dict (headers as keys) or array |
includeHeader | boolean | false | Include header row? |
allTables | boolean | false | Extract all tables? |
extractMetadata | boolean | false | Page categories, description, infobox, last-modified, page stats |
includeLinks | boolean | false | Extract href links from anchor elements |
sectionContext | boolean | false | Include nearest h2/h3 heading per table |
caption | string | β | Table <caption> text auto-extracted |
New metadata fields (when extractMetadata=true):
lastEditedβ ISO date of the latest edit (from Wikipedia's page-info page)pageLengthβ page content length in bytes (accurate, from page-info)editCountβ total number of edits to the page (accurate, from page-info)pageIdβ Wikipedia article IDwikiDataIdβ Wikidata entity ID (Q...)revisionIdβ current revision numbercanonicalTitleβ page title (wgTitle)namespaceNameβ namespace name (e.g. "Talk", "Template")pageNameβ full page path with underscores (wgPageName)protectionLevelβ edit protection level(s), comma-joinedlastEditorβ username of the last editorlanguageβ page language codepageCreatorβ username of the page creatorcreatedOnβ date the page was created (ISO when parseable)watchersCountβ number of page watcherstemplateCountβ number of transcluded templatescontributorsCountβ number of distinct page contributors (from page-info)sitelinksCountβ number of Wikidata sitelinks for the articletalkPageUrlβ URL of the article's talk pageisOrphanβ set totruewhen the article has no incoming links from other articlesincomingLinksCountβ number of incoming article links (article namespace only, from the backlinks API; capped at ~1500)externalLinksCountβ number of distinct external links in the article contentreferencesCountβ number of reference-list items in the articlesectionsβ list of the article's section headings (h2)isRedirect/redirectedFromβ set when the requested URL was a redirectisDisambiguationβ set on disambiguation pagesisStubβ set on stub pages
Pricing
$0.001 per result ($0.50 per 1k rows).