how to extract text from images using excel vba with Tesseract OCR

In below video, I have explained and give you vba visual basic application code to convert all bulk images text into Excel sheet using google Tesseract OCR.


Please watch full video and understood all requirement and follow the steps. Contact me for any further support and projects: Click here to contact me

Follow the following Steps.

Step 1. Download Tesseract OCR (https://github.com/tesseract-ocr/tesseract)

Step 2. Add Path in your PC: Type “Path in search tab in window”

Step 3. VBA code: select Reference library as “Microsoft shell controls and automation”

Step 4. Get and run below VBA code and enjoy.

Sub Image_into_Excelby_Ajit_Yadav()
On Error Resume Next
Dim myshell As Shell32.Shell, ReadCommand, CaptchaCode, i
Set myshell = New Shell32.Shell
For i = 1 To 5 ' Change it
ReadCommand = "tesseract.exe " & "'C:\Users\Kumar Ajit\Downloads\All Images\Image " & i & ".png'" & " " & "'C:\Users\Kumar Ajit\Downloads\All Images\READ\Image " & i & "'" & " ' -l eng'"
myshell.ShellExecute "powershell", vArgs:=ReadCommand, vShow:=0
Application.Wait (Now + TimeValue("00:00:05"))
Open "C:\Users\Kumar Ajit\Downloads\All Images\READ\Image " & i & ".txt" For Input As #1
Line Input #1, CaptchaCode
Close #1
Application.Wait (Now + TimeValue("00:00:02"))
MyCaptchaCode = Application.WorksheetFunction.Substitute(CaptchaCode, Chr(10), "")
Cells(i + 1, 2).Value = Trim(Application.WorksheetFunction.Clean(MyCaptchaCode))
Cells(i + 1, 1).Value = "Sr. " & i
Next i
End Sub

Tage: how to extract text from image using excel vba

Extract Text from a picture in excel