r/computervision • • Oct 06 '26

Help: Project OCR Recs: Image -> CSV/Excel

I work in a research lab, and need to digitize a few hundred pages of spreadsheets. All spreadsheets are printed, not handwritten, but the original files are lost. The images have the same general schema, but the columns aren't always in the same order, and some pages have columns that others don't. Some pages are fainter, but still readable; some are slightly slanted. The end goal is for all pages to be compiled into one master spreadsheet, with the same schema. What's the best (and cheapest) tool for this?

I have tried chatgpt (best so far, but still slow/made mistakes), Google Document AI (not that great), and ParseExtract (great, but more limited in scope).

3 Upvotes

18 comments sorted by

1

u/FirestormCold Oct 30 '26

Have you found a solution? Flew over some of the comments and simply using OCR or an open source model probably won't cut it

1

u/trainsatr Oct 30 '26

Everything I've tried either doesn't work as intended or requires some level of human oversight. Either there are parsing errors, OCR errors, it takes way too long, or is too expensive. Part of it may be the quality of the images I'm uploading. I also think that LLM tools aren't quite there yet to 100% accurately go from an input of 300 images -> 1 OCR'd and parsed spreadsheet. The variety of spreadsheet types/layouts makes setting up training sets extremely laborous. So, I decided to use a simple OCR tool instead, and acknowledged that I would have to manually check things here and there.

I like ParseExtract. It's 1 cent per image, so for the 350 images or so that I have it's less than $4. Not nothing, but not ridiculous compared to other tools. It's also by far the fastest tool I've tried. It also allows you to use API calls to batch process images, which is what I've been doing. I had an LLM develop a script tailored to my workflow which is as follows:

  1. Pre-processing: Combine images into folders based on the spreadsheet layout. A good bit of work, but saves a lot of time at the end and you only have to do it once.
  2. Run the Script: Script sends an API request to my ParseExtract account. The script takes 1 image at a time, runs OCR on it through ParseExtract, and saves the output csv into an output folder. Once all images in the folder are processed (usually 30s to 2min per photo), the script combines all output csvs into one combined .xlsx file.
  3. Post-processing: Not a single OCR tool I've used has been perfect. ParseExtract virtually always gets the character recognition right, but sometimes the slant of the image leads to a mismatch between rows/columns. So, for EVERY single csv output: I choose 3 random rows (one top, one middle, one bottom), and make sure that the information is correct and that there was no frameshift. If there was a frameshift, it is easy to correct. This is what takes the most time, but I have trust issues and would manually check things regardless of the software I use. After confirming that everything is correct, I delete any unnecessary columns, re-order columns to match my desired schema, and paste the combined .xlsx into a google sheet (which is my final product).
  4. Repeat: Repeat this process for every folder (which corresponds to every sheet layout).

I'm sure there are faster ways to do this, but for only 300-500 pages, optimizing would just end up taking more time (I'm a rather novice coder). If this were a regular task of my job, or I had thousands of pages, I would spend much more time researching and optimizing my workflow.

1

u/FirestormCold Oct 30 '26

Soo it sounds like you found what you need, at least for now?

Generally speaking, if you want a fully autonomous pipeline with zero human oversight you will either

A) have to wait quite a while and accept the risk that always comes with that kind of system

B) accept there'll be minimal human oversight necessary from time to time

C) settle for a solution that uses grounding so any output can be traced to the source input, meaning if mistakes do happen you at least know what's going on

1

u/liltingly Oct 06 '26

Paddle has a whole suite of tools in their pipeline to handle this. Docling also works. And datalab has some good products. If the spreadsheets are somewhat regular all you need is a script to align columns and rows to their headers and then remap to unique keys in the master. 

What didn’t work with the tools you tried since they should have worked just as well as any I listed?

1

u/trainsatr Oct 06 '26

Google Cloud’s Document AI would regularly put things into the wrong columns, whether using the custom extractor with training/test sets or form parser. Honestly didn’t mess around with it all that much, so maybe there are ways to go about using it. Still have some free credits there.

Chatgpt (pro) was certainly the most powerful, but when checking I found OCR errors, skipped rows, and other mistakes.

ParseExtractor is good for simple OCR (image to table), but at the moment can’t batch it or have it align columns in different orders. Also could certainly mess around with it a bit more.

1

u/liltingly Oct 06 '26

Yeah. See if you can have an LLM write a post processing script for any of the outputs. Even boring OCR with bboxes should allow you to rebuild the table if it’s typeset. Might still have errors but a lot are pretty simple substitutions. Maybe posting a snippet of what types of structures they are? Eg are cells numbers? Dates? Strings? Headers? Were the docs typeset by word processing software, typewriters?

I think anything will require some post processing. Using the standard OCRs as your engines will give you reliable positioning and mostly consistent error types. And the pipelines I mentioned wrap it with some semantic processing and let you integrate the VLM layer in too if you want. 

1

u/trainsatr Oct 07 '26

I think that’s probably the way forward. ParseExtract seemed to work pretty well for basic image -> excel, and I’m sure I can figure out some post-processing code. Definitely seems like it will be necessary no matter what. It’s wildlife sample metadata, so IDs, dates, coordinates, etc. Mostly plaintext but some numbers and dates. Thank you for the detailed response.

1

u/Infamous-Bed-7535 Oct 07 '26

Interesting problem. We could help much more if you would share a few samples.

1

u/trainsatr Oct 07 '26

Would rather not share direct samples but will do my best to explain. It’s hundreds of pages of wildlife sample metadata. Date of collection, coordinates, sample ID, etc. Many different “sets”, all with the same basic column headers but slightly different header names and sometimes different orders. An example set would look like this: 10 total pages. First page has headers [Box #, Grid Code, Sample ID, Date of Collection, Easting, Northing, UTM Zone, Coord System, Notes] followed by ~50 rows of information. The remaining pages do not have headers but have the same format. Another example set may have 5 pages, but this time, Sample ID and Date of Collection are switched in their order of appearance. Additionally, the following 4 pages of this set may have headers, unlike the first set. Hopefully that makes sense. There are probably 50-75 of these sets. Some of the exact same structure, others differ slightly.

1

u/Capable-Package6835 Oct 07 '26

Do all of your printed spreadsheets have cell borders? If so, it's significantly easier:

  1. Increase contrast so faint lines become clearer, e.g., with CLAHE
  2. Do morph close operation so cell borders that have gaps from print imperfection become solid and fully connected
  3. Get the contour, with RETR_TREE. The hierarchy level 2 or 3 should give you the individual spreadsheet cells.
  4. Crop each cell from using contour from step 3 (but use the original image or image after step 1) and perform OCR on it.
  5. Assemble, assign the OCR results from step 4 and assign to the right cell from step 3. This gives you the right spreadsheet structure.

If you cannot guarantee that all printed sheets have cell borders, it's slightly more difficult. As you have encountered, even specialized models struggle with getting the correct structures. Give UnlimitedOCR from Baidu a try and test it on a couple of pages to see if that's accurate enough for you.

I did something similar a couple of months ago, but for printed tables instead of spreadsheets. Since that was for training data, having 0 mistake was the absolute requirement for me. Here's what I did:

  1. Vibe-coded a web app to annotate the images
  2. On the app I can draw lines and whenever the lines intersect and form a quadrilateral, that automatically becomes a cell
  3. Similar to in Excel, I can select the cells and merge them or delete them

I managed to do that for about 9000 printed tables in slightly more than a week (completely eye-strained though). So if you only need a couple of hundreds you should be able to do this in a day or two.

1

u/trainsatr Oct 07 '26

Luckily, the tables do have lines. At least for the most part. I've found that ParseExtract is quite rapid and extremely accurate for jpg -> excel. At least more rapid than any other tool I've used while maintaining accuracy of characters and of structure. Also not terribly pricey for the number of pages I have (1 cent a page). The problem has been batching it. From upload to opening an excel file, I've found that it takes 15-45 seconds for one jpg. I tried to submit multi-page pdfs of the images, but the tool was not able to process those.

So, I figured the best thing was, as you said, to vibe code a script that could help me batch it. For me, the best way to do this involves some manual pre-processing and some post-processing. Both minimal. Pre-processing almost exclusively means creating folders for each "structure", or "format", of spreadsheets. So, every single image I have that shares the same structure goes into the same folder. The script then goes into that folder, takes one image at a time, and runs an API call to my ParseExtract account, which runs the OCR and saves the output excel file into a separate folder. The script then continues to the next file in the folder. Once all files have been processed, the script combines all of the output excel files into one master excel file, which is fine, because all files in that folder share the same structure.

For post-processing: on that master file, I manually rearrange the order of columns, which takes less than a minute. I also choose a number of rows from each file to manually check (I had no training data). Then, I copy and paste all of the entries into my final, QC'd sample catalog.

Are there faster ways to do this? Probably. But, to be honest, this is really only a one-time project and I've already spent so much time experimenting that I think I'll just stick with something I know works. Shouldn't take me more than another day or two. Thank you to all who helped provide input and recs.

1

u/Potential-Wrangler58 Oct 07 '26

This is exactly what Anyformat is built for, disclosure: I work there. You define one master schema, and every page gets mapped to it by column header instead of position, so shuffled columns and missing ones stop being your problem. Faint and slanted pages are handled in the same pipeline, and you get a confidence score per field so you only check the doubtful cells instead of the whole sheet.

There are free credits, so just upload 10-15 of your worst pages and compare the output against what you got from ChatGPT and Document AI. If it holds up on those, run the full batch. Happy to help you set up the schema if you send me a DM.

Separately, whichever tool you use, check numeric columns against the totals where the originals have them, since digits are where every model slips.

1

u/trainsatr Oct 07 '26

I checked it out, and the UI is very clean. The integrated AI assistant was helpful too. I quite like the setup. However, I couldn't get the extract tool to properly align my columns in a reasonable amount of time (which to be fair, virtually no tool has been able to do mostly autonomously). I would've liked to experiment more, but unfortunately, I quite quickly reached my daily spend limit before I could finalize a workflow that delivered good results.

1

u/Potential-Wrangler58 Oct 08 '26

Thanks a lot for trying it and for the honest feedback, really appreciated. Sorry you hit the daily spend limit before you could finish. Aligning shuffled columns is exactly the hard part of your case, and I'd like to see why it didn't work out.

If you write to support@anyformat.ai, we'll go through your workflow together and add credits so you can experiment properly. If you're comfortable sharing a few of your worst pages, we can look at the setup on your actual data and get the column mapping right.