Urgent.News

What's breaking now, across hundreds of outlets.

Tech

Table OCR to Excel: wrapped cells had no cheap fix, 11 of 34 still wrong on an unruled sample

Picture a freelance request: the client has a work-order table, but what arrives is a screenshot, and the job is to get it into a spreadsheet. OCR reads the characters fine and the columns break. On a self-made 7 × 5 sample with six two-line cells, rebuilding the grid from box coordinates left 4 of 34 cells wrong when the table had ruling lines and 11 of 34 when it did not. Cutting along the…

A client sent a screenshot of a table for conversion into an Excel spreadsheet. The OCR recognized the characters correctly, but the columns did not break properly. When rebuilding the grid using box coordinates, 4 of 34 cells were incorrect when the table had ruling lines and 11 of 34 cells were incorrect when the table did not have ruling lines.

The sample was a fictional work-order table with 7 rows and 5 columns, consisting of 34 non-empty cells. Six cells contained two lines of text. The table was provided in two versions: one with ruling lines and one without.

The recognition process was performed using ImgIng (https://imging.ai/) with the default tier and desktop browser on an Apple-silicon Mac. The results were exported as TXT and JSON files containing the coordinates of each text box.

A script was used to compare the exported text with the ground truth, considering a cell to be wrong if it was not in its original row and column. The plain export placed every row into two cells instead of five, resulting in 34 out of 34 cells being misplaced for both versions. However, the text and row count were accurate.

The JSON file contained 40 boxes for 34 cells, with the extra six representing the second lines of the wrapped cells. There was no indication in the boxes that they represented the lower half of the cell above. The script grouped boxes into rows based on the center y-coordinate, with a tolerance of 0.5 times the box height. It projected the boxes onto the x-axis to find column gaps, which were at least 0.2 times the box height wide in at least 80% of the rows.

The wrap rule then applied one rule: if a row's first column was empty, it was folded into the row above. This rule left 4 of 34 cells incorrect on the ruled image, and all four were wrapped cells whose second lines were reversed. On the unruled image, the rule joined the second line of one row to the first line of the next row, resulting in 11 of 34 cells being incorrect.

No cause for the issue was traced, and it was concluded that a top-down fold does not hold for this sample. Ruling lines were crucial in recovering all 34 cells correctly. An alternative approach, which ignored text positions, binarized the image, extracted horizontal and vertical lines, treated each white region as a cell, and dropped every text box into the cell holding its center.

This method detected 35 cells for the ruled table, restored all six wrapped cells as two lines each, and left 0 of 34 cells incorrect. For the unruled version, there was nothing to cut along, so the 11 cells remained incorrect.

For a one-person shop, the cost would be approximately one cell in three, which is relatively low. If the image contains ruling lines, it is recommended to cut along them. If there are no ruling lines, sending a message to the sender requesting an export with gridlines or the original file may be a more cost-effective solution than attempting to fine-tune the thresholds.

Rewritten by urgent.news; may contain errors — check the original.

This story

This is one outlet's version. Read the fullest account.

Every outlet that reported this, and when →

Read the original at dev.to →

Report a problem with this story

More in Tech

Twitter/X API Rate Limits in 2026: The Complete Guide

The #1 Pain Point for Twitter API Developers If you've worked with the X (formerly Twitter) API for any length of time, you've hit a rate limit. It's practically a rite of passage.

  • Twitter/X API rate limits changed in February 2026 to a pay-per-use model.
  • New accounts receive a $20 credit and first auto-recharge match up to $50.
  • Responses include three rate limit headers: limit, remaining, and reset timestamps.

A trash cleanup that deleted records a day early, and how I tested it in 2 minutes

Twenty, the open-source CRM, keeps deleted records in the trash for 14 days before deleting them for good. At least, that's what it says.

  • CRM Twenty retains deleted records for 14 days before permanent deletion.
  • Bug caused record deleted at 23:59 UTC to be permanently deleted at 00:10 UTC.
  • ChronoStack allows testing of time-based features in two minutes.

Build Better Engineers, Not Just Better Software

I once worked on a coding project where I was effectively the junior. I had picked up a fix, worked through it and opened a pull request. I was pumped about it.

  • Lead DevOps consultants guide junior engineers.
  • Psychological safety crucial for team growth.
  • Constructive feedback encourages independent problem-solving.

More from Saturday 21 November →