r/GoogleAppsScript • u/Strict-Bed2587 • Apr 20 '26
Question OCR automation to google sheets
To start with, I am not someone who has studied about writing scripts. However, I have a few scripts that are currently being used, courtesy of being written by chatgpt, I know, it has a lot of errors and I had to do a lot of back and forth to get a working script.
What I currently need is something that can read the names and numbers from a set of images and automatically enter it into Google sheet rows and columns. For example, team members and their weekly performance numbers. What I need the script to do is take the names and numbers from the images, let OCR do it's thing, match the names and enter their respective numbers for the current week.
I just want to understand whether this is actually possible to be done or chatgpt is taking me on a hallucination spree? I am sorry in advance if the use of ai is a taboo or something to write scripts.
Edit: Currently the scripts that I have running can be considered basic. From the top of my head,
1: Google form that keeps a record of a respondents answers. The script basically takes the responses and forwards it over an app while tagging us.
2: A drop-down row for each response that sends out a template email depending on the drop-down that is selected.
Edit 2: I have been able to get this working using gemini flash lite 3.1 and flash 2.5 as a backup option when it faces rate limits. Getting a handful of 503 service errors rn but I guess that is just something I'll have to deal with on this free service. The world of api has really surprised me. A few years ago I would never think all this could be automated with scripts. This place is a gold mine
1
u/Unlikely-Soup2418 Apr 20 '26
I do exactly this. I tried a few different OCR options. For me chatGPT 5-mini via API works the best (I have a lot of handwriting in my form). But one of the Google options can possibly work for you. It reads from the jpg/pdf and adds the data to the sheet.
1
u/WillingnessOwn6446 Apr 20 '26
super doable. gemini flash 2.5 as the OCR works great. I do this for invoices. Email pdf, to OCR, to sheets.
DM me and I'll share my script and you can crib off it
1
u/Imp0mp0 Apr 22 '26
Ive donde something similar using gemini. The script sends the image to gemini and it gives me back the text, then gives me the informstion that i need. Its not 100% acurate, but works well most of the tines.
1
u/david_0_0 Apr 27 '26
Google Drive has built-in OCR that's completely free and works natively in Apps Script - upload the image with the convert:true flag and it creates a Google Doc with the extracted text automatically. for printed text and numbers it works well and avoids any external API costs entirely. worth trying before going the paid API route
1
u/Feisty-Cloud7611 May 05 '26
Nice that you already got the Gemini route working. At this point I would probably focus less on the OCR call itself and more on making the pipeline boring/recoverable.
Things I would add:
Apps Script can do this, but it gets messy fast. This is also a good n8n use case because the retry/logging/review steps are easier to see visually.
I'm trying to build more real n8n workflow examples for my portfolio, so if you ever want help hardening this flow, I'd be happy to take a look for free.
1
u/volumeandsurface911 Apr 28 '26
Google drive has a hidden, free OCR engine built into its API. You enable the Advanced Drive Service in Apps Script and when passing the file = Drive.Files… you pass in this param {ocr:true} once the text is extracted, you can hit Gemini API free tier to extract info if needed.
1
u/[deleted] Apr 20 '26
[removed] — view removed comment
1
u/[deleted] Apr 21 '26
[removed] — view removed comment
1
u/[deleted] Apr 21 '26
[removed] — view removed comment
1
u/[deleted] Apr 21 '26
[removed] — view removed comment