{"id":8117,"date":"2019-09-20T20:57:37","date_gmt":"2019-09-20T11:57:37","guid":{"rendered":"https:\/\/itport.cloud\/?p=8117"},"modified":"2019-12-12T14:31:03","modified_gmt":"2019-12-12T05:31:03","slug":"post-8117","status":"publish","type":"post","link":"https:\/\/itport.cloud\/?p=8117","title":{"rendered":"OCR\u3092\u4f7f\u3063\u305f\u696d\u52d9\u52b9\u7387\u5316"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\" id=\"e79baee6aca1-1\">\u76ee\u6b21<\/h2>\n\n\n\n<p><a href=\"#OCR-1\">\u306f\u3058\u3081\u306b<\/a><br><a href=\"#OCR-2\">\u52b9\u7387\u5316\u3057\u305f\u3044\u696d\u52d9\u5185\u5bb9<\/a><br><a href=\"#OCR-3\">\u4f7f\u7528\u30c4\u30fc\u30eb<\/a><br><a href=\"#OCR-4\">\u30e1\u30fc\u30eb\u304b\u3089\u6dfb\u4ed8\u30d5\u30a1\u30a4\u30eb\u3092\u81ea\u52d5\u4fdd\u5b58<\/a><br><a href=\"#OCR-5\">OCR\u3067\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u30d5\u30a1\u30a4\u30eb\u306b\u5909\u63db<\/a><br><a href=\"#OCR-6\">\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8\u3078\u8ee2\u8a18<\/a><br><a href=\"#OCR-7\">\u30a4\u30d9\u30f3\u30c8\u30c8\u30ea\u30ac\u30fc\u3092\u8a2d\u5b9a<\/a><br><a href=\"#OCR-8\">\u6700\u5f8c\u306b<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"OCR-1\">\u306f\u3058\u3081\u306b<\/h2>\n\n\n\n<p>\u6628\u4eca\u591a\u304f\u306e\u4f01\u696d\u3067\u696d\u52d9\u52b9\u7387\u5316\u304c\u63a8\u9032\u3055\u308c\u3001\u5f93\u6765\u7d19\u3067\u3084\u308a\u3068\u308a\u3055\u308c\u3066\u3044\u305f\u696d\u52d9\u3082\u6b21\u3005\u3068\u96fb\u5b50\u30c7\u30fc\u30bf\u5316\u3055\u308c\u3066\u3044\u307e\u3059\u3002<br>\u3057\u304b\u3057\u4f9d\u7136\u3068\u3057\u3066\u7d19\u3092\u4f7f\u7528\u3059\u308b\u696d\u52d9\u3082\u591a\u304f\u3001\u305d\u308c\u3089\u3092\u81ea\u52d5\u5316\u3059\u308b\u305f\u3081\u306e\u65b0\u305f\u306a\u6280\u8853\u304c\u6b21\u3005\u3068\u751f\u307e\u308c\u3066\u3044\u307e\u3059\u3002<br>\u4eca\u56de\u306fPDF\u3084\u753b\u50cf\u3092\u30c6\u30ad\u30b9\u30c8\u30c7\u30fc\u30bf\u5316\u3059\u308bOCR(Optical Character Recognition\/Reader )\u6280\u8853\u3092\u5229\u7528\u3057\u3001<br>\u696d\u52d9\u52b9\u7387\u5316\u306b\u5f79\u7acb\u3064\u30b7\u30b9\u30c6\u30e0\u3092\u4f5c\u6210\u3057\u3066\u307f\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"OCR-2\">\u52b9\u7387\u5316\u3057\u305f\u3044\u696d\u52d9\u5185\u5bb9<\/h2>\n\n\n\n<p>\u55b6\u696d\u306e\u696d\u52d9\u306e\u4f8b\u3068\u3057\u3066\u3001\u9867\u5ba2\u304b\u3089\u306e\u62bc\u5370\u4ed8\u6ce8\u6587\u66f8\u3092FAX\u3084\u30e1\u30fc\u30eb\u306b\u6dfb\u4ed8\u3055\u308c\u305f<br>pdf\u30d5\u30a1\u30a4\u30eb\u3067\u3044\u305f\u3060\u304d\u3001\u305d\u308c\u3092\u76ee\u8996\u3057\u3066\u5225\u30b7\u30b9\u30c6\u30e0\u3078\u5165\u529b\u3001\u3068\u3044\u3046\u3082\u306e\u304c\u3042\u308a\u307e\u3059\u3002<br>\u3053\u306e\u696d\u52d9\u306b\u95a2\u3057\u3066\u3001\u6b21\u306e\u3088\u3046\u306a\u30b7\u30b9\u30c6\u30e0\u3092\u4f5c\u6210\u3057\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Google Drive\u306b\u5bfe\u8c61\u6dfb\u4ed8\u30d5\u30a1\u30a4\u30eb\u3092\u81ea\u52d5\u4fdd\u5b58<\/li><li>pdf\u30c7\u30fc\u30bf\u3092OCR\u3092\u5229\u7528\u3057\u6587\u5b57\u8d77\u3053\u3057<\/li><li>\u30c6\u30ad\u30b9\u30c8\u30c7\u30fc\u30bf\u3092\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8\u3078\u8ee2\u8a18<\/li><\/ol>\n\n\n\n<p>\u4eca\u56de\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u7533\u8fbc\u66f8\u3092\u7528\u610f\u3057\u307e\u3057\u305f\u3002<br>\u3053\u3061\u3089\u3092\u4f7f\u7528\u3057\u3066\u6587\u5b57\u8d77\u3053\u3057\u3092\u884c\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/apply.png\" alt=\"\" class=\"wp-image-8161\" width=\"626\" height=\"569\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"OCR-3\">\u4f7f\u7528\u30c4\u30fc\u30eb<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li>Gmail<\/li><li>Google Drive<\/li><li>Google Sheets<\/li><li>GAS (Google Apps Script)<\/li><\/ul>\n\n\n\n<p>GAS (Google Apps Script)\u3068\u306f\u3001Google\u304c\u63d0\u4f9b\u3059\u308b\u30b5\u30fc\u30d0\u30fc\u30b5\u30a4\u30c9\u30b9\u30af\u30ea\u30d7\u30c8\u74b0\u5883\u3067\u3059\u3002<br>Google\u304c\u63d0\u4f9b\u3059\u308b\u69d8\u3005\u306a\u30b5\u30fc\u30d3\u30b9\u3068\u306e\u9023\u643a\u304c\u53ef\u80fd\u3067\u3001\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8\u3084Gmail\u3001Google\u30c9\u30e9\u30a4\u30d6\u3092\u7528\u3044\u305f\u696d\u52d9\u306e\u81ea\u52d5\u5316\u306b\u6700\u9069\u3067\u3059\u3002<\/p>\n\n\n\n<p>Google\u30a2\u30ab\u30a6\u30f3\u30c8\u3001\u30d6\u30e9\u30a6\u30b6\u3001\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u74b0\u5883\u304c\u3042\u308c\u3070\u8ab0\u3067\u3082\u7121\u6599\u3067\u59cb\u3081\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<p> GAS\u3067\u3067\u304d\u308b\u3053\u3068\u3084\u8a73\u3057\u3044\u59cb\u3081\u65b9\u306f\u4e0b\u8a18\u3092\u53c2\u7167\u3044\u305f\u3060\u3051\u308c\u3070\u3068\u601d\u3044\u307e\u3059\u3002 <br><a href=\"https:\/\/developers.google.com\/apps-script\/overview\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (\u65b0\u3057\u3044\u30bf\u30d6\u3067\u958b\u304f)\">https:\/\/developers.google.com\/apps-script\/overview<\/a> <br><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"OCR-4\">\u30e1\u30fc\u30eb\u304b\u3089\u6dfb\u4ed8\u30d5\u30a1\u30a4\u30eb\u3092\u81ea\u52d5\u4fdd\u5b58<\/h2>\n\n\n\n<p>OCR\u6a5f\u80fd\u3092\u5229\u7528\u3059\u308b\u524d\u306b\u3001\u307e\u305a\u53d7\u4fe1\u30e1\u30fc\u30eb\u304b\u3089\u5bfe\u8c61\u30d5\u30a1\u30a4\u30eb\u3092\u691c\u7d22\u3001Google Drive\u3078\u4fdd\u5b58\u3057\u307e\u3059\u3002<br>\u4e8b\u524d\u306b\u30de\u30a4\u30c9\u30e9\u30a4\u30d6\u306b\u300ctestOCR\u300d\u3068\u3044\u3046\u30d5\u30a9\u30eb\u30c0\u3092\u6e96\u5099\u3057\u3066\u3044\u307e\u3059\u3002<br>\u3053\u306e\u30d5\u30a9\u30eb\u30c0\u306bpdf\u30d5\u30a1\u30a4\u30eb\u3092\u4fdd\u5b58\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u307e\u305f\u30d5\u30a9\u30eb\u30c0\u3092\u6307\u5b9a\u3059\u308b\u969b\u3001\u300c\u30d5\u30a9\u30eb\u30c0ID\u300d\u304c\u5fc5\u8981\u3067\u3059\u3002<br>\u3053\u3061\u3089\u306f\u30de\u30a4\u30c9\u30e9\u30a4\u30d6\u4e0a\u3067\u5bfe\u8c61\u30d5\u30a9\u30eb\u30c0\u3092\u53f3\u30af\u30ea\u30c3\u30af\u3001\u300c\u5171\u6709\u53ef\u80fd\u306a\u30ea\u30f3\u30af\u3092\u53d6\u5f97\u300d\u304b\u3089\u53d6\u5f97\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/share-1-1024x464.png\" alt=\"\" class=\"wp-image-8148\" width=\"796\" height=\"358\"\/><\/figure>\n\n\n\n<p>\u4eca\u56de\u306f\u4ef6\u540d\u306b\u300c\u7533\u8fbc\u66f8\u300d\u304c\u542b\u307e\u308c\u3001\u304b\u3064\u672a\u8aad\u306e\u3082\u306e\u3060\u3051\u3092\u691c\u7d22\u3057\u307e\u3059\u3002<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nfunction attachedFile() {\n  var search='subject:(\u7533\u8fbc\u66f8) is:unread';\n  var testOCR = DriveApp.getFolderById('\u30d5\u30a9\u30eb\u30c0ID');\n}\n<\/pre><\/div>\n\n\n<p>\u4ed6\u306b\u3082\u5dee\u51fa\u4eba\u3084\u53d7\u4fe1\u65e5\u6642\u306a\u3069\u3001Gmail\u306e\u4e0b\u8a18\u691c\u7d22\u30a6\u30a3\u30f3\u30c9\u30a6\u306b\u3042\u308b\u69d8\u3005\u306a\u6761\u4ef6\u3067\u691c\u7d22\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/\u7533\u8fbc\u66f8\u691c\u7d22-1024x688.png\" alt=\"\" class=\"wp-image-8124\" width=\"626\" height=\"406\"\/><\/figure>\n\n\n\n<p>\u4ee5\u4e0b\u306e\u901a\u308a\u4ef6\u540d\u306b\u300c\u7533\u8fbc\u66f8\u300d\u3092\u542b\u3080\u30e1\u30fc\u30eb\u30922\u901a\u7528\u610f\u3057\u307e\u3057\u305f\u3002<br>1\u4ef6\u306f\u65e2\u8aad\u306a\u306e\u3067\u3001\u7533\u8fbc\u66f8\u2460\u306e\u307f\u4fdd\u5b58\u3055\u308c\u308c\u3070ok\u3067\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/mail-1-1024x392.png\" alt=\"\" class=\"wp-image-8153\" width=\"904\" height=\"334\"\/><\/figure>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n\/\/\u691c\u7d22\u6761\u4ef6\u306b\u30de\u30c3\u30c1\u3057\u305f\u30b9\u30ec\u30c3\u30c9\u53d6\u5f97\nvar threads=GmailApp.search(search);\n\/\/\u30b9\u30ec\u30c3\u30c9\u304b\u3089\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u53d6\u5f97\nvar messages=GmailApp.getMessagesForThreads(threads);\n  \n\/\/\u53d6\u5f97\u3057\u305f\u30e1\u30fc\u30eb\u304b\u3089\u6dfb\u4ed8\u30d5\u30a1\u30a4\u30eb\u3092\u53d6\u5f97\nfor(var thCnt in messages){\n  for(var meCnt in messages&#x5B;thCnt]){\n\n    var attachments=messages&#x5B;thCnt]&#x5B;meCnt].getAttachments();\n\n\u3000\u3000\u3000\/\/\u30c9\u30e9\u30a4\u30d6\u306b\u30d5\u30a1\u30a4\u30eb\u3092\u4fdd\u5b58\n      for(var fileCnt in attachments){\n        testOCR.createFile(attachments&#x5B;fileCnt]);\n      }\n  }\n}\n<\/pre><\/div>\n\n\n<p>Gmail\u3067\u306f\u8907\u6570\u306e\u30e1\u30c3\u30bb\u30fc\u30b8\u304c\u30b9\u30ec\u30c3\u30c9\u3068\u3057\u3066\u307e\u3068\u3081\u3089\u308c\u3066\u3044\u308b\u305f\u3081\u3001<br>\u30e1\u30c3\u30bb\u30fc\u30b8\u306f[\u30b9\u30ec\u30c3\u30c9][\u30e1\u30c3\u30bb\u30fc\u30b8]\u306e2\u6b21\u5143\u914d\u5217\u3067\u53d6\u5f97\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u30d5\u30a1\u30a4\u30eb\u304c\u4fdd\u5b58\u3055\u308c\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/save-1024x511.png\" alt=\"\" class=\"wp-image-8154\" width=\"829\" height=\"402\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"OCR-5\">OCR\u3067\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u30d5\u30a1\u30a4\u30eb\u306b\u5909\u63db<\/h2>\n\n\n\n<p>\u30c9\u30e9\u30a4\u30d6\u306b\u4fdd\u5b58\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u305f\u3089\u3001\u6b21\u306fOCR\u6a5f\u80fd\u3092\u5229\u7528\u3057\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u30d5\u30a1\u30a4\u30eb\u3078\u5909\u63db\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>OCR\u6a5f\u80fd\u3092\u4f7f\u7528\u3059\u308b\u305f\u3081\u3001\u307e\u305a\u30b9\u30af\u30ea\u30d7\u30c8\u30a8\u30c7\u30a3\u30bf\u306e\u300c\u30ea\u30bd\u30fc\u30b9\u300d\u30bf\u30d6\u3088\u308a\u300cGoogle\u62e1\u5f35\u30b5\u30fc\u30d3\u30b9\u300d\u3092\u9078\u629e\u3001DriveAPI\u3092\u300c\u6709\u52b9\u300d\u306b\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/kakucho-1-1024x472.png\" alt=\"\" class=\"wp-image-8145\" width=\"798\" height=\"369\" srcset=\"https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/kakucho-1-1024x472.png 1024w, https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/kakucho-1-300x138.png 300w, https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/kakucho-1-768x354.png 768w, https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/kakucho-1-450x208.png 450w, https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/kakucho-1-900x415.png 900w\" sizes=\"auto, (max-width: 798px) 100vw, 798px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/kakucho2-1024x651.png\" alt=\"\" class=\"wp-image-8142\" width=\"506\" height=\"310\"\/><\/figure>\n\n\n\n<p>testOCR\u30d5\u30a9\u30eb\u30c0\u304b\u3089\u5bfe\u8c61\u30d5\u30a1\u30a4\u30eb\u3092\u53d6\u5f97\u3001\u5909\u63db\u524d\u306bBlob\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\uff08 Apps Script\u30b5\u30fc\u30d3\u30b9\u306e\u30c7\u30fc\u30bf\u4ea4\u63db\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\uff09\u3092\u53d6\u5f97\u3057\u307e\u3059\u3002<br><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nfunction ocr(){\n  \/\/testOCR\u30d5\u30a9\u30eb\u30c0\u304b\u3089pdf\u30d5\u30a1\u30a4\u30eb\u53d6\u5f97\n  var pdfFiles=testOCR.getFiles();\n  \n  while(pdfFiles.hasNext()){\n    \n    var pdfFile=pdfFiles.next();\n    var fileName=pdfFile.getName();\n\n    \/\/\u4f5c\u6210\u3059\u308b\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306e\u60c5\u5831\n    var resource={\n      title: fileName, \/\/\u30d5\u30a1\u30a4\u30eb\u540d\n      mineType: 'pdf'  \/\/\u30d5\u30a1\u30a4\u30eb\u30bf\u30a4\u30d7\n    };\n    \/\/\u30d5\u30a1\u30a4\u30eb\u304b\u3089Blob\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u53d6\u5f97\n    var data=pdfFile.getBlob();\n  }\n}\n<\/pre><\/div>\n\n\n<p>\u4ee5\u4e0b\u3067OCR\u3092\u6709\u52b9\u5316\u3057\u3001\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u30d5\u30a1\u30a4\u30eb\u306b\u5909\u63db\u3057\u3066\u3044\u307e\u3059\u3002<br>\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u30d5\u30a1\u30a4\u30eb\u306f\u30de\u30a4\u30c9\u30e9\u30a4\u30d6\u76f4\u4e0b\u306b\u4f5c\u6210\u3055\u308c\u308b\u306e\u3067\u3001testOCR\u30d5\u30a9\u30eb\u30c0\u3078\u8ffd\u52a0\u3057\u76f4\u4e0b\u306b\u3042\u308b\u30d5\u30a1\u30a4\u30eb\u306f\u524a\u9664\u3057\u307e\u3059\u3002 <br><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n\u3000\u3000\/\/OCR\u6709\u52b9\u5316\u3001\u30d5\u30a1\u30a4\u30ebID\u53d6\u5f97\n    var fileId = Drive.Files.insert(resource, data, {ocr: true}).id;\n    var newFile=DriveApp.getFileById(fileId);\n\n\u3000\u3000\/\/\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u30d5\u30a1\u30a4\u30eb\u3092testOCR\u30d5\u30a9\u30eb\u30c0\u3078\n\u3000\u3000testOCR.addFile(newFile);\n    DriveApp.getRootFolder().removeFile(newFile);\n<\/pre><\/div>\n\n\n<p>\u6587\u5b57\u8d77\u3053\u3057\u306e\u7cbe\u5ea6\u3092\u78ba\u8a8d\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"589\" height=\"787\" src=\"https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/1-1.png\" alt=\"\" class=\"wp-image-8160\" srcset=\"https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/1-1.png 589w, https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/1-1-225x300.png 225w, https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/1-1-239x320.png 239w, https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/1-1-479x640.png 479w\" sizes=\"auto, (max-width: 589px) 100vw, 589px\" \/><\/figure>\n\n\n\n<p>\u30c6\u30ad\u30b9\u30c8\u306f\u307b\u307c\u6b63\u78ba\u306b\u53d6\u5f97\u3067\u304d\u305f\u306e\u3067\u3059\u304c\u3001\u304a\u5ba2\u69d8ID\u306e\u90e8\u5206\u304c\u753b\u50cf\u306e\u3088\u3046\u306b\u8907\u6570\u884c\u306b\u307e\u305f\u304c\u3063\u3066\u3057\u307e\u3044\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<p>\u7f6b\u7dda\u3082\u6587\u5b57\u3068\u3057\u3066\u6349\u3048\u3089\u308c\u3066\u3057\u307e\u3063\u305f\u3053\u3068\u3084\u7a7a\u767d\u304c\u6539\u884c\u3068\u5224\u65ad\u3055\u308c\u305f\u3053\u3068\u304c\u539f\u56e0\u306a\u306e\u3067\u306f\u3068\u601d\u3044\u3001ID\u8a18\u5165\u6b04\u306e\u7f6b\u7dda\u3092\u524a\u9664\u3057\u4ed6\u306e\u884c\u3068\u540c\u69d8\u306e\u5f62\u5f0f\u306b\u4fee\u6b63\u3057\u518d\u5ea6\u8a66\u3057\u3066\u307f\u307e\u3057\u305f\u3002<br><br><\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/\u7f6b\u7dda\u524a\u9664\u5f8cpdf-1.png\" alt=\"\" class=\"wp-image-8186\" width=\"602\" height=\"518\"\/><\/figure>\n\n\n\n<p><br>\u4ee5\u4e0b\u304c\u5909\u63db\u5f8c\u306e\u30d5\u30a1\u30a4\u30eb\u3067\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"774\" height=\"878\" src=\"https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/2-1.png\" alt=\"\" class=\"wp-image-8159\" srcset=\"https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/2-1.png 774w, https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/2-1-264x300.png 264w, https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/2-1-768x871.png 768w, https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/2-1-282x320.png 282w, https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/2-1-564x640.png 564w\" sizes=\"auto, (max-width: 774px) 100vw, 774px\" \/><\/figure>\n\n\n\n<p>\u884c\u306e\u305a\u308c\u3084\u8a18\u5165\u6b04\u5916\u5074\u306e\u67a0\u7dda\u304c\u591a\u5c11\u6b8b\u3063\u3066\u3044\u307e\u3059\u304c\u3001\u307b\u307c\u89e3\u6d88\u3055\u308c\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"OCR-6\">\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8\u3078\u8ee2\u8a18<\/h2>\n\n\n\n<p>\u4f5c\u6210\u3057\u305f\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u30d5\u30a1\u30a4\u30eb\u304b\u3089\u30c6\u30ad\u30b9\u30c8\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3057\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8\u3078\u8ee2\u8a18\u3057\u307e\u3059\u3002<br>\u7f6b\u7dda\u524a\u9664\u5f8c\u306e\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u3092\u4f7f\u7528\u3057\u3001\u6539\u884c\u533a\u5207\u308a\u3067\u8ee2\u8a18\u3059\u308b\u3088\u3046\u306b\u3057\u307e\u3057\u305f\u3002<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nvar sheet=SpreadsheetApp.getActiveSheet();\n    \n    var newFile=DocumentApp.openById(fileId);\n\u3000\u3000\/\/\u30c6\u30ad\u30b9\u30c8\u30c7\u30fc\u30bf\u4ee3\u5165\n    var ocrText = newFile.getBody().getText();\n    \n\u3000\u3000\/\/\u6539\u884c\u533a\u5207\u308a\u3067\u914d\u5217\u4ee3\u5165\n    var textArray=ocrText.split('\\n');\n    \n\u3000\u3000\/\/\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8\u3078\u5165\u529b\n    for(var arrCnt=0; arrCnt&lt;textArray.length; arrCnt++){\n      sheet.getRange(arrCnt+1, 1).setValue(textArray&#x5B;arrCnt]);\n    }\n<\/pre><\/div>\n\n\n<p>\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8\u306b\u5165\u529b\u3055\u308c\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/sheet-1024x972.png\" alt=\"\" class=\"wp-image-8162\" width=\"473\" height=\"448\" srcset=\"https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/sheet-1024x972.png 1024w, https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/sheet-300x285.png 300w, https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/sheet-768x729.png 768w, https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/sheet-337x320.png 337w, https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/sheet-674x640.png 674w, https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/sheet.png 1200w\" sizes=\"auto, (max-width: 473px) 100vw, 473px\" \/><\/figure>\n\n\n\n<p>\u4ee5\u4e0b\u304c\u30b3\u30fc\u30c9\u5168\u6587\u3067\u3059\u3002\u30e1\u30fc\u30eb\u53d6\u5f97\uff5e\u6dfb\u4ed8\u30d5\u30a1\u30a4\u30eb\u81ea\u52d5\u4fdd\u5b58\u3001OCR\u6a5f\u80fd\u306e\u5229\u7528\uff5e\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8\u3078\u306e\u8ee2\u8a18\u3001\u306e2\u3064\u306b\u5206\u3051\u3001ocr_test\u306b\u3066\u547c\u3073\u51fa\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nfunction ocr_test(){\n  attachedFile();\n  ocr();\n}\n\nfunction attachedFile() {\n  \n  var search='subject:(\u7533\u8fbc\u66f8) is:unread';\n  var testOCR = DriveApp.getFolderById('\u30d5\u30a9\u30eb\u30c0ID');\n  \n  \/\/\u691c\u7d22\u6761\u4ef6\u306b\u30de\u30c3\u30c1\u3057\u305f\u30b9\u30ec\u30c3\u30c9\u53d6\u5f97\n  var threads=GmailApp.search(search);\n  \/\/\u30b9\u30ec\u30c3\u30c9\u304b\u3089\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u53d6\u5f97\n  var messages=GmailApp.getMessagesForThreads(threads);\n  \n  \/\/\u53d6\u5f97\u3057\u305f\u30e1\u30fc\u30eb\u304b\u3089\u6dfb\u4ed8\u30d5\u30a1\u30a4\u30eb\u3092\u53d6\u5f97\n  for(var thCnt in messages){\n    for(var meCnt in messages&#x5B;thCnt]){\n    \n      var attachments=messages&#x5B;thCnt]&#x5B;meCnt].getAttachments();\u3000\n      \n      \/\/\u30c9\u30e9\u30a4\u30d6\u306b\u30d5\u30a1\u30a4\u30eb\u3092\u4fdd\u5b58\n      for(var fileCnt in attachments){\n        testOCR.createFile(attachments&#x5B;fileCnt]);\n      }\n    }\n  }\n}\n\nfunction ocr(){\n  var testOCR = DriveApp.getFolderById('\u30d5\u30a9\u30eb\u30c0ID');\n  \/\/testOCR\u30d5\u30a9\u30eb\u30c0\u304b\u3089pdf\u30d5\u30a1\u30a4\u30eb\u53d6\u5f97\n  var pdfFiles=testOCR.getFiles();\n  \n  while(pdfFiles.hasNext()){\n\n    var pdfFile=pdfFiles.next();\n    var fileName=pdfFile.getName();\n\n    \/\/\u4f5c\u6210\u3059\u308b\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306e\u60c5\u5831\n    var resource={\n      title: fileName, \/\/\u30d5\u30a1\u30a4\u30eb\u540d\n      mineType: 'pdf'  \/\/\u30d5\u30a1\u30a4\u30eb\u30bf\u30a4\u30d7\n    };\n    \/\/\u30d5\u30a1\u30a4\u30eb\u304b\u3089Blob\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u53d6\u5f97\n    var data=pdfFile.getBlob();\n    \n    \/\/OCR\u6709\u52b9\u5316\u3001\u30d5\u30a1\u30a4\u30ebID\u53d6\u5f97\n    var fileId = Drive.Files.insert(resource, data, {ocr: true}).id;\n    var newFile=DriveApp.getFileById(fileId);\n    \n    \/\/\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u30d5\u30a1\u30a4\u30eb\u3092testOCR\u30d5\u30a9\u30eb\u30c0\u3078\n\u3000\u3000testOCR.addFile(newFile);\n    DriveApp.getRootFolder().removeFile(newFile);\n    \n    var sheet=SpreadsheetApp.getActiveSheet();\n    \n    var newFile=DocumentApp.openById(fileId);\n    \/\/\u30c6\u30ad\u30b9\u30c8\u30c7\u30fc\u30bf\u4ee3\u5165\n    var ocrText = newFile.getBody().getText();\n    \n    \/\/\u6539\u884c\u533a\u5207\u308a\u3067\u914d\u5217\u4ee3\u5165\n    var textArray=ocrText.split('\\n');\n    \n    \/\/\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8\u3078\u5165\u529b\n    for(var arrCnt=0; arrCnt&lt;textArray.length; arrCnt++){\n      sheet.getRange(arrCnt+1, 1).setValue(textArray&#x5B;arrCnt]);\n    } \n  }\n }\n<\/pre><\/div>\n\n\n<h2 class=\"wp-block-heading\" id=\"OCR-7\">\u30a4\u30d9\u30f3\u30c8\u30c8\u30ea\u30ac\u30fc\u3092\u8a2d\u5b9a<\/h2>\n\n\n\n<p>\u6700\u5f8c\u306b\u3001\u4e0a\u8a18\u4f5c\u696d\u3092\u5b9a\u671f\u7684\u306b\u884c\u3046\u305f\u3081\u306e\u30a4\u30d9\u30f3\u30c8\u30c8\u30ea\u30ac\u30fc\u3092\u8a2d\u5b9a\u3057\u307e\u3059\u3002<br>\u30b9\u30af\u30ea\u30d7\u30c8\u30a8\u30c7\u30a3\u30bf\u753b\u9762\u306e\u300c\u7de8\u96c6\u300d\u30bf\u30d6\u3088\u308a\u300c\u73fe\u5728\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u30c8\u30ea\u30ac\u30fc\u300d\u3092\u9078\u629e\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/\u30c8\u30ea\u30ac\u30fc-3-1024x669.png\" alt=\"\" class=\"wp-image-8136\" width=\"547\" height=\"348\"\/><\/figure>\n\n\n\n<p>\u300c\u30c8\u30ea\u30ac\u30fc\u3092\u8ffd\u52a0\u300d\u3092\u62bc\u4e0b\u3059\u308b\u3068\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u8ffd\u52a0\u753b\u9762\u306b\u306a\u308a\u307e\u3059\u306e\u3067\u3001\u30a4\u30d9\u30f3\u30c8\u306e\u30bd\u30fc\u30b9\u3084\u30bf\u30a4\u30d7\u3092\u9078\u629e\u3057\u3066\u304f\u3060\u3055\u3044\u3002<br>\u4eca\u56de\u306f\u6bce\u65e5\u671d8\u6642\uff5e9\u6642\u306b\u8a2d\u5b9a\u3057\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<p>\u65e5\u4ed8\u30d9\u30fc\u30b9\u306e\u30bf\u30a4\u30de\u30fc\u3092\u8a2d\u5b9a\u3059\u308b\u3068\u3001\u5b9f\u884c\u6642\u9593\u3092\u3007\u6642\u3007\u5206\u3001\u3068\u6b63\u78ba\u306b\u6c7a\u3081\u308b\u3053\u3068\u306f\u3067\u304d\u305a\u3001\u3007\u6642\uff5e\u3007\u6642\u3068\u3044\u3063\u305f\u5e45\u306e\u3042\u308b\u8a2d\u5b9a\u306b\u306a\u308a\u307e\u3059\u3002<br>\u3053\u306e\u5e45\u306e\u4e2d\u30671\u56de\u5b9f\u884c\u3055\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/itport.cloud\/wp-content\/uploads\/2019\/09\/\u30c8\u30ea\u30ac\u30fc2-1.png\" alt=\"\" class=\"wp-image-8135\" width=\"436\" height=\"296\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"OCR-8\">\u6700\u5f8c\u306b<\/h2>\n\n\n\n<p>\u59cb\u3081\u3066\u89e6\u3063\u305fGoogle\u306eOCR\u6a5f\u80fd\u3067\u3057\u305f\u304c\u3001\u65e5\u672c\u8a9e\u30fb\u6570\u5b57\u3092\u307b\u307c\u6b63\u78ba\u306b\u8a8d\u8b58\u3067\u304d\u3066\u304a\u308a\u3001\u7cbe\u5ea6\u306e\u9ad8\u3055\u3092\u611f\u3058\u307e\u3057\u305f\u3002<br>\u305f\u3060\u7f6b\u7dda\u3084\u7a7a\u767d\u306e\u6271\u3044\u65b9\u7b49\u306b\u306f\u307e\u3060\u6ce8\u610f\u3059\u3079\u304d\u70b9\u304c\u591a\u304f\u3001\u5229\u7528\u8005\u5074\u3067\u6b32\u3057\u3044\u60c5\u5831\u306e\u5f62\u5f0f\u306a\u3069\u3092\u4e8b\u524d\u306b\u5b9a\u3081\u3066\u304a\u304f\u5fc5\u8981\u304c\u3042\u308a\u305d\u3046\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u307e\u305f\u30c6\u30ad\u30b9\u30c8\u5316\u5f8c\u306e\u30c7\u30fc\u30bf\u306e\u6271\u3044\u65b9\u3082\u5de5\u592b\u304c\u5fc5\u8981\u3060\u3068\u611f\u3058\u307e\u3057\u305f\u3002<br>\u7533\u8fbc\u66f8\u306a\u3069\u7d71\u4e00\u3055\u308c\u305f\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u306a\u3089\u3070\u30c6\u30ad\u30b9\u30c8\u4f4d\u7f6e\u306f\u304a\u305d\u3089\u304f\u4f3c\u305f\u3082\u306e\u306b\u306a\u308b\u306e\u3067\u3001\u305d\u308c\u3092\u5229\u7528\u3059\u308b\u3053\u3068\u3067\u3055\u3089\u306b\u4f7f\u3044\u3084\u3059\u3044\u30c7\u30fc\u30bf\u3092\u4f5c\u6210\u3067\u304d\u308b\u306e\u3067\u306f\u306a\u3044\u3067\u3057\u3087\u3046\u304b\u3002<\/p>\n\n\n\n<p>\u5de5\u592b\u6b21\u7b2c\u3067OCR\u6a5f\u80fd\u306e\u6d3b\u7528\u65b9\u6cd5\u304c\u5e83\u304c\u308b\u3053\u3068\u304c\u308f\u304b\u308a\u307e\u3057\u305f\u3002\u7121\u6599\u3067\u5229\u7528\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u306e\u3067\u3001\u4eca\u5f8c\u3082\u3088\u308a\u4fbf\u5229\u306a\u65b9\u6cd5\u3092\u63a2\u3057\u3066\u307f\u3088\u3046\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p><br><br><\/p>\n\n\n\n<div class=\"wp-block-columns has-2-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\"><\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\"><\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"\u76ee\u6b21 \u306f\u3058\u3081\u306b\u52b9\u7387\u5316\u3057\u305f\u3044\u696d\u52d9\u5185\u5bb9\u4f7f\u7528\u30c4\u30fc\u30eb\u30e1\u30fc\u30eb\u304b\u3089\u6dfb\u4ed8\u30d5\u30a1\u30a4\u30eb\u3092\u81ea\u52d5\u4fdd\u5b58OCR\u3067\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u30d5\u30a1\u30a4\u30eb\u306b\u5909\u63db\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8\u3078\u8ee2\u8a18\u30a4\u30d9\u30f3\u30c8\u30c8\u30ea\u30ac\u30fc\u3092\u8a2d\u5b9a\u6700\u5f8c\u306b \u306f\u3058\u3081\u306b \u6628\u4eca\u591a\u304f\u306e\u4f01\u696d\u3067\u696d\u52d9\u52b9\u7387\u5316\u304c\u63a8\u9032\u3055\u308c\u3001\u5f93\u6765\u7d19\u3067\u3084\u308a\u3068\u308a\u3055\u308c\u3066\u3044\u305f\u696d\u52d9\u3082\u6b21\u3005\u3068\u96fb\u5b50\u30c7\u30fc\u30bf\u5316\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u3057\u304b\u3057\u4f9d\u7136\u3068\u3057\u3066\u7d19\u3092\u4f7f\u7528\u3059\u308b\u696d\u52d9\u3082\u591a\u304f\u3001\u305d\u308c\u3089\u3092\u81ea\u52d5\u5316\u3059\u308b\u305f\u3081\u306e\u65b0\u305f\u306a\u6280\u8853\u304c\u6b21\u3005\u3068\u751f\u307e\u308c\u3066\u3044\u307e\u3059\u3002\u4eca\u56de\u306fPDF\u3084\u753b\u50cf\u3092\u30c6\u30ad\u30b9\u30c8\u30c7\u30fc\u30bf\u5316\u3059\u308bOCR(Optical Character Recognition\/Reader )\u6280\u8853\u3092\u5229\u7528\u3057\u3001\u696d\u52d9\u52b9\u7387\u5316\u306b\u5f79\u7acb\u3064\u30b7\u30b9\u30c6\u30e0\u3092\u4f5c\u6210\u3057\u3066\u307f\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002 \u52b9\u7387\u5316\u3057\u305f\u3044\u696d\u52d9\u5185\u5bb9 \u55b6\u696d\u306e\u696d\u52d9\u306e\u4f8b\u3068\u3057\u3066\u3001\u9867\u5ba2\u304b\u3089\u306e\u62bc\u5370\u4ed8\u6ce8\u6587\u66f8\u3092FAX&hellip;","protected":false},"author":21,"featured_media":8172,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[62],"tags":[40],"class_list":{"0":"post-8117","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-ocr","8":"tag-article"},"_links":{"self":[{"href":"https:\/\/itport.cloud\/index.php?rest_route=\/wp\/v2\/posts\/8117","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itport.cloud\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itport.cloud\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itport.cloud\/index.php?rest_route=\/wp\/v2\/users\/21"}],"replies":[{"embeddable":true,"href":"https:\/\/itport.cloud\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=8117"}],"version-history":[{"count":46,"href":"https:\/\/itport.cloud\/index.php?rest_route=\/wp\/v2\/posts\/8117\/revisions"}],"predecessor-version":[{"id":8196,"href":"https:\/\/itport.cloud\/index.php?rest_route=\/wp\/v2\/posts\/8117\/revisions\/8196"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/itport.cloud\/index.php?rest_route=\/wp\/v2\/media\/8172"}],"wp:attachment":[{"href":"https:\/\/itport.cloud\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=8117"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itport.cloud\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=8117"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itport.cloud\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=8117"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}