Program Explanation
Overview
This program extracts text from an image containing names and scores, parses the data, and saves it into an Excel sheet. The current date and time in PST are also added to each record.
Steps
-
Text Extraction:
- The
pytesseract.image_to_stringfunction is used to extract text from the image. - The
Pillowlibrary is used to open and process the image.
- The
-
Parsing:
- The extracted text is split into lines.
- Each line is further split into words. The last word is assumed to be the score, and the rest are combined to form the name.
- The program ensures that the score is a valid integer before adding the data.
-
Date Handling:
- The
datetimeandpytzlibraries are used to get the current date and time in the PST timezone. - The date is formatted as
YYYY-MM-DD HH:MM:SS.
- The
-
Excel Writing:
- The
openpyxllibrary is used to create and write data into an Excel file. - The data is written into three columns: Player Name, Player Score, and Date (PST).
- The
Requirements
Libraries
Install the required libraries using pip:
pip install pytesseract pillow openpyxl pytz
Description
Languages
Python
100%