Posts

Showing posts from May, 2022

How to Extract Text from PDF Files with Google Apps Script

  This tutorial explains how you can parse and extract text elements from invoices, expense receipts and other PDF documents with the help of Apps Script. An external accounting system generates paper receipts for its customers which are then scanned as PDF files and uploaded to a folder in Google Drive. These PDF invoices have to be parsed and specific information, like the invoice number, the invoice date and the buyer’s email address, needs to be extracted and saved into a Google Spreadsheet. Here’s a sample PDF invoice that we’ll use in this example Our PDF extractor script will read the file from Google Drive and use Google Drive API to convert to a text file. We can then use RegEx to parse this text file and write the extracted information into a Google Sheet. Let’s get started. Step 1. Convert PDF to Text Assuming that the PDF files is already in our Google Drive, we’ll write a little function that will convert the PDF file to text. Please ensure the Adva...