Data that should be a CSV keeps turning up as something else: a table in a PDF report, a screenshot in a slide deck, a dashboard with the export button switched off for your role. For a small table, OCR (text recognition) gets it into a spreadsheet or a DataFrame in seconds. For a large extraction job, it’s the wrong tool, and knowing the difference saves a lot of cleanup.
Look for the real data first: an export, an HTML table or a text-based PDF. For a table that only exists as pixels, capture it with a tool that puts tab-separated text on the clipboard. Paste it into a spreadsheet, or read it in pandas with read_clipboard and a tab separator, or in R with read.delim and pbpaste. Check the shape, types and totals before trusting it.
Where tables get stuck
Each source has a better and a worse route:
- Text-based PDFs contain real characters, just positioned on a page. Dedicated PDF table extractors handle these better than OCR.
- Scanned PDFs and images are pixels. OCR is the only way in.
- Dashboards and BI tools render tables in the browser. Sometimes the HTML is real and copyable; sometimes it’s a canvas.
- Screenshots in decks, chats and tickets are pixels, often small and compressed.
- Web pages usually hold real HTML tables, which
pandas.read_html()reads directly.
First, check for real data underneath
Two minutes of checking can save an hour of cleaning:
- Ask for the export. The dashboard owner can often grant export rights or share the query behind the view.
- Select text in the PDF. If you can drag across the table in Preview, the PDF is text-based. Copying usually scrambles the columns, but a PDF table extractor will do better than OCR here.
- Inspect the page. Right-click a table cell and choose Inspect Element in Safari (after turning on its web developer features) or Inspect in Chrome. Real
<table>markup means you can scrape or copy it as text.
Only when all three come up empty is OCR the right call.
Paste into a spreadsheet
Spreadsheets split tab-separated text into cells when you paste it. That’s the format to aim for. Live Text in Preview recognizes the characters in a table well, but it copies lines of text rather than tab-separated cells, so the columns collapse into one.
In Unpixel
Unpixel detects tables in a capture. Press ⇧⌘2, drag over the table, and let go. The clipboard gets HTML and tab-separated text, so Numbers, Excel and Google Sheets paste real cells, and the confirmation shows the shape, header row included (“13 rows × 4 columns”). Plain-text apps such as Terminal and code editors get the format set in Settings → Recognition → Tables as plain text. Leave it on Tab-separated for the recipes below.
From the history, right-click any table to choose Copy as CSV or Copy as Markdown. From Clipboard reads a table image someone pasted into a chat, and Open Image… reads a scanned PDF of up to 50 pages.
Into pandas or R from the clipboard

In pandas, read_clipboard() hands the clipboard text to read_csv(). Its default separator is any run of whitespace, which splits cells containing spaces. Always pass the tab:
import pandas as pd
df = pd.read_clipboard(
sep="\t", # tab-separated: cells may contain spaces
thousands=",", # "1,284" -> 1284
na_values=["—", "–", "n/a"],
)
df.to_csv("q3_regions_from_pdf_p14.csv", index=False) # keep a copy, name the source
Any read_csv() option works here, including decimal="," for European figures and dtype to keep IDs as strings. If you used Copy as CSV instead, pass sep=",".
In R, the documentation suggests reading the macOS clipboard through pbpaste. read.delim() already expects tabs and a header row:
df <- read.delim(pipe("pbpaste"), check.names = FALSE)
str(df)
To keep a file of the raw capture, run pbpaste > capture.tsv in Terminal before you start transforming anything.
Validate the numbers
OCR errors in data are quiet: a misread digit is still a valid number. Build the checks into the same cell or script:
- Shape. Compare rows and columns with the source; a merged header cell often adds or drops a column. pandas turns the header row into column names, so
df.shapeshows one row fewer than a count that includes the header. - Types. A column that should be numeric but comes back as
objectholds something odd: an O for a 0, a stray space, a footnote marker, a Unicode minus sign. - Coerce and inspect.
pd.to_numeric(df["Q1"], errors="coerce")turns the odd cells into NaN, anddf[df["Q1"].isna()]shows you exactly which ones to fix. - Totals. If the source prints a total row or column, recompute it and compare.
- Spot-check. Pick a few random rows and compare every cell with the original image.
for col in ["Q1", "Q2"]:
df[col] = pd.to_numeric(df[col], errors="coerce")
print(df[df[["Q1", "Q2"]].isna().any(axis=1)]) # rows that need a look
assert abs(df["Q1"].sum() - 48_210) < 1 # printed total from the report
Big extraction jobs: other tools
Screen OCR is for a table or two at a time. For dozens of PDFs, or the same report every month, use a tool built for batch extraction:
- Tabula reads tables from text-based PDFs, not scans. As of October 2026, its README describes it as volunteer-run and says the desktop app is unlikely to see updates in the near future.
- Camelot is a Python library for text-based PDFs, also not scans. It exports to CSV, JSON, Excel, HTML, Markdown and SQLite, so it fits a scripted pipeline.
- For scanned documents at volume, you need a batch OCR pipeline or a document-processing service, plus the same validation as above.
Whatever extracts the data, the checks don’t change. Shape, types, totals and a spot-check against the source belong in every pipeline that starts from a document instead of a database.
Frequently asked questions
Why does read_clipboard split my columns in the wrong places?
Its default separator is any run of whitespace, so a cell like “North America” becomes two columns. Pass sep="\t" when the clipboard holds tab-separated text.
Can OCR get the data behind a chart?
No. OCR reads the labels and numbers printed on a chart, not values encoded in bar heights or line positions. Ask for the underlying data, or use a plot-digitizing tool and treat the result as an estimate.
Should I keep OCR’d data in my analysis?
Keep it, but label it. Note the source document, the page, the capture date and that it came from OCR, so anyone rerunning the analysis knows where the numbers came from and how they were checked.
Sources
- pandas.read_clipboard — pandas documentation pandas.pydata.org
- pandas.read_csv — pandas documentation pandas.pydata.org
- Functions to manipulate connections (clipboard on macOS) — R documentation stat.ethz.ch
- Tabula — GitHub (README, as of October 2026) github.com
- Camelot: PDF table extraction for humans — documentation camelot-py.readthedocs.io






