Skip to content

Instantly share code, notes, and snippets.

@cfinch
cfinch / batch_ocr.gs
Last active July 27, 2023 17:10 — forked from kltng/batch_ocr.gs
Google Apps script for performing OCR on all images of a certain type found in the specified Drive folder. Extracts text to a Google sheet, where it's mapped to the image's filename.
function extractTextOnOpen() {
//ADD YOUR VALUES BELOW
var folderName = "[YOUR FOLDER NAME]";
var sheetUrl = "[YOUR SHEET URL] (should start with https://docs.google.com/spreadsheets/d/)"
var imageType = "image/png"
//Define folder
var folder = DriveApp.getFoldersByName(folderName).next();
var folderId = folder.getId();
#!/bin/bash
# Credit to Ivan Zahariev at https://blog.famzah.net/2014/06/04/private-tmp-mount-per-process-in-linux/
TARGET_CMD=$1
NEWTMP="$(mktemp -d)"
chown "root:root" "$NEWTMP"
chmod 770 "$NEWTMP"