メインコンテンツにスキップ

gas-gocr2notion

Google Drive で OCR を行い、結果を Notion データベースへ送信する Google Apps Script ライブラリー。

AI Summary

gas-gocr2notion

A Google Apps Script library that runs OCR on Google Drive files and stores the text in a Notion database.

Target Users

Intermediate Google Apps Script developers who need to organise scanned files from Google Drive into Notion.

Problems Solved

Eliminate the manual, error-prone process of running OCR on Drive files and copying the text into Notion.

Tags

Main Features

1
One-line OCR & Notion integration

A single call to GocrToNotion.ocr() performs Drive OCR and pushes the result to a Notion database.

2
Automation via Drive change notifications

Using the send() method, OCR can be triggered by Drive change notifications and reflected in Notion within minutes.

3
Attach tags and metadata

Optional parameters let you save tags and file metadata into Notion properties.

4
Optional removal of OCR files

The removeOcrFile option automatically deletes the OCR copy from Drive after processing.

Usage Examples

OCR a PDF and push it to Notion

function myFunction() {
  // Notion integration token
  const apiKey = 'notion_api_key';
  // Destination database ID
  const database_id = 'database_id';
  // Google Drive folder ID containing scans
  const folder_id = 'folder_id';

  const opts = {
    database_id,
    ocrOpts: [
      {
        scanFolderId: folder_id,   // Folder with PDFs/images
        ocrFolderId: folder_id,    // Folder to save OCR files
        ocrLanguage: 'ja',         // Recognition language
        tags: [],                  // Optional tags for Notion
        removeOcrFile: true        // Delete OCR copy after upload
      }
    ]
  };

  // Run OCR and send the result to Notion
  GocrToNotion.ocr(apiKey, opts);
}

Copy-and-paste, replace notion_api_key, database_id, and folder_id with your own values, then run the function. The script OCRs PDFs/images in the folder and adds the recognised text to your Notion database.