{"id":11440,"date":"2023-03-13T07:00:21","date_gmt":"2023-03-12T22:00:21","guid":{"rendered":"https:\/\/blog.capilano-fw.com\/?p=11440"},"modified":"2023-02-16T19:23:14","modified_gmt":"2023-02-16T10:23:14","slug":"%e3%80%90laravel%e3%80%91google-sheet-%e3%81%a8-db-%e3%82%92%e5%90%8c%e6%9c%9f%e3%81%99%e3%82%8b%ef%bc%88apps-script%ef%bc%89","status":"publish","type":"post","link":"https:\/\/blog.capilano-fw.com\/?p=11440","title":{"rendered":"\u3010Laravel\u3011Google sheet \u3068 DB \u3092\u540c\u671f\u3059\u308b\uff08Apps Script\uff09"},"content":{"rendered":"<p>\u3055\u3066\u3055\u3066\u3001\u79c1\u3082\u9577\u3089\u304f\u958b\u767a\u306e\u304a\u4ed5\u4e8b\u3092\u3055\u305b\u3066\u3044\u305f\u3060\u3044\u3066\u3044\u308b\u306e\u3067\u3059\u304c\u3001\u6700\u8fd1<\/p>\n<p><strong style=\"font-size: 35px;\">\u300c\u3042\u2757\u3053\u308c\u306f\u6c17\u3092\u3064\u3051\u306a\u3044\u3068\u300d<\/strong><\/p>\n<p>\u3068\u611f\u3058\u308b\u3053\u3068\u304c\u3042\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>\u8a73\u7d30\u306f\u8a71\u305b\u307e\u305b\u3093\u304c\u3001\u3042\u308b\u3068\u304d\u300c<strong>\u76f4\u63a5 DB \u30c7\u30fc\u30bf\u3092\u5909\u66f4\u3057\u305f\u3044<\/strong>\u300d\u3068\u3044\u3046\u3054\u5e0c\u671b\u304c\u3042\u3063\u305f\u306e\u3067<code>PhpMyAdmin<\/code>\u3092\u3054\u63d0\u6848\u3057\u305f\u306e\u3067\u3059\u304c\u3001\u8fd4\u7b54\u3068\u3057\u3066\u306f\u3001<\/p>\n<p><strong style=\"font-size: 35px;\">\u300cGoogle Sheet \u304c\u4f7f\u3044\u6163\u308c\u3066\u308b\u306e\u3067\u305d\u3063\u3061\u3067\u3044\u3051\u306a\u3044\u3067\u3057\u3087\u3046\u304b\u2026\ud83d\ude05\u300d<\/strong><\/p>\n<p>\u3068\u3044\u3046\u3082\u306e\u3067\u3057\u305f\u3002<\/p>\n<p>\u305d\u3057\u3066\u3001\u3053\u306e\u4ef6\u3067\u611f\u3058\u305f\u306e\u304c\u300c<strong>\u958b\u767a\u8005\u306b\u3068\u3063\u3066\u99b4\u67d3\u307f\u306e\u3042\u308b PhpMyAdmin \u306f\u4f7f\u3044\u3084\u3059\u3044\u3051\u3069\u3001\u4e00\u822c\u4eba\u304b\u3089\u3059\u308b\u3068\u306a\u304b\u306a\u304b\u5927\u5909\u3060\u3088\u306a\u2026<\/strong>\u300d\u3068\u3044\u3046\u3082\u306e\u3067\u3057\u305f\u3002<\/p>\n<p>\u305d\u3053\u3067\u2757<\/p>\n<p>\u4eca\u56de\u306f<code>Google sheet<\/code>\u3067\u5909\u66f4\u3055\u308c\u305f\u3089\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u3067\u30c7\u30fc\u30bf\u3092\u66f4\u65b0\u3067\u304d\u308b\u30a6\u30a7\u30d6\u30d5\u30c3\u30af\u3092<code>Laravel<\/code>\u3067\u5b9f\u88c5\u3057\u3066\u307f\u308b\u3053\u3068\u306b\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u305c\u3072\u4f55\u304b\u306e\u53c2\u8003\u306b\u306a\u308a\u307e\u3057\u305f\u3089\u5b09\u3057\u3044\u3067\u3059\u3002\ud83d\ude04\u2728<\/p>\n<p style=\"text-align: center;\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3566 aligncenter\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/04\/no_1.png\" alt=\"\" width=\"306\" height=\"320\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/04\/no_1.png 306w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/04\/no_1-287x300.png 287w\" sizes=\"auto, (max-width: 306px) 100vw, 306px\" \/>\u300c\u4eca\u56de\u304b\u3089 <code>Laravel 10.x<\/code><br \/>\n\u3092\u4f7f\u3063\u3066\u8a18\u4e8b\u3092\u66f8\u3044\u3066\u307e\u3059\u300d<\/p>\n<p><strong>\u958b\u767a\u74b0\u5883\uff1a<\/strong> Laravel 10.x \u2728<\/p>\n<h1>Google Sheet \u5074\u306e\u4f5c\u696d<\/h1>\n<p>\u307e\u305a\u306f<code>Google Sheet<\/code>\u306b\u300c<strong>\u5909\u66f4\u3084\u8ffd\u52a0\u304c\u3042\u3063\u305f\u3089\u30a6\u30a7\u30d6\u30d5\u30c3\u30af\u3092\u5b9f\u884c\u3059\u308b<\/strong>\u300d\u6a5f\u80fd\u3092\u4f5c\u3063\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<h1>Google App Script \u3092\u66f8\u304f<\/h1>\n<p>\u3067\u306f\u3001\u308f\u304b\u308a\u3084\u3059\u3044\u3088\u3046\u306b<code>Google Drive<\/code>\u304b\u3089\u79fb\u52d5\u3059\u308b\u65b9\u6cd5\u3092\u3054\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n<p>\u753b\u9762\u5de6\u4e0a\u306b\u3042\u308b\u300c<strong>\u65b0\u898f<\/strong>\u300d\u3068\u3044\u3046\u30dc\u30bf\u30f3\u3092\u30af\u30ea\u30c3\u30af\u3057\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-11454\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/03\/laravel_google_sheet_sync_1.png\" alt=\"\" width=\"255\" height=\"187\" \/><\/p>\n<p>\u30e1\u30cb\u30e5\u30fc\u304c\u8868\u793a\u3055\u308c\u308b\u306e\u3067\u3001\u300c<strong>Google \u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8<\/strong>\u300d\u3092\u30af\u30ea\u30c3\u30af\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-11453\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/03\/laravel_google_sheet_sync_2.png\" alt=\"\" width=\"345\" height=\"408\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/03\/laravel_google_sheet_sync_2.png 345w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/03\/laravel_google_sheet_sync_2-254x300.png 254w\" sizes=\"auto, (max-width: 345px) 100vw, 345px\" \/><\/p>\n<p>\u3059\u308b\u3068\u3001\u65b0\u3057\u3044\u30b7\u30fc\u30c8\u304c\u8868\u793a\u3055\u308c\u308b\u306e\u3067\u9069\u5f53\u306b\u30bf\u30a4\u30c8\u30eb\u3092\u5909\u66f4\u3057\u3066\u304f\u3060\u3055\u3044\u3002\uff08<code>Google Sheet<\/code>\u304b\u3089\u76f4\u63a5\u3053\u306e\u30da\u30fc\u30b8\u3078\u6765\u3066\u3082\u554f\u984c\u3042\u308a\u307e\u305b\u3093\uff09<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-11452\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/03\/laravel_google_sheet_sync_3.png\" alt=\"\" width=\"442\" height=\"235\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/03\/laravel_google_sheet_sync_3.png 442w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/03\/laravel_google_sheet_sync_3-300x160.png 300w\" sizes=\"auto, (max-width: 442px) 100vw, 442px\" \/><\/p>\n<p>\u6b21\u306b\u3001\u30b7\u30fc\u30c8\u304c\u5909\u66f4\u3055\u308c\u305f\u3068\u304d\u5b9f\u884c\u3055\u308c\u308b\u300c<strong>Apps Script<\/strong>\u300d\u3092\u66f8\u304d\u307e\u3059\u3002<\/p>\n<p>\u300c<strong>\u62e1\u5f35\u6a5f\u80fd \uff1e Apps Script<\/strong>\u300d\u3092\u30af\u30ea\u30c3\u30af\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-11451\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/03\/laravel_google_sheet_sync_4.png\" alt=\"\" width=\"422\" height=\"240\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/03\/laravel_google_sheet_sync_4.png 422w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/03\/laravel_google_sheet_sync_4-300x171.png 300w\" sizes=\"auto, (max-width: 422px) 100vw, 422px\" \/><\/p>\n<p>\u3059\u308b\u3068\u3001<code>Apps Script<\/code>\u306e\u30b3\u30fc\u30c9\u30a8\u30c7\u30a3\u30bf\u304c\u8868\u793a\u3055\u308c\u308b\u306e\u3067\u3001\u4e2d\u8eab\u3092\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u306b\u5165\u308c\u66ff\u3048\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p><strong>\u30b3\u30fc\u30c9.gs<\/strong><\/p>\n<div>\n<pre><strong>function onSheetUpdated() {<\/strong>\r\n\r\n<strong>    const spreadSheetId = '\uff08\u3042\u306a\u305f\u306e\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8ID\uff09'; \/\/ DB \u3068\u540c\u671f\u3057\u305f\u3044\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8\u306eID<\/strong>\r\n<strong>    const activeSpreadSheet = SpreadsheetApp.getActiveSpreadsheet();<\/strong>\r\n<strong>    const activeSpreadSheetId = activeSpreadSheet.getId();<\/strong>\r\n\r\n<strong>    if(spreadSheetId === activeSpreadSheetId) {<\/strong>\r\n        \r\n<strong>        const url = 'https:\/\/\uff08\u3042\u306a\u305f\u306e\u30c9\u30e1\u30a4\u30f3\uff09\/google_sheet\/webhook';<\/strong>\r\n<strong>        const data = { spreadsheet_id: spreadSheetId };<\/strong>\r\n<strong>        const options = {<\/strong>\r\n<strong>            method: 'post',<\/strong>\r\n<strong>            contentType: 'application\/json',<\/strong>\r\n<strong>            payload: JSON.stringify(data)<\/strong>\r\n<strong>        };<\/strong>\r\n\r\n<strong>        UrlFetchApp.fetch(url, options);<\/strong>\r\n\r\n<strong>  }<\/strong>\r\n\r\n<strong>}<\/strong><\/pre>\n<p>\u3053\u306e\u4e2d\u3067\u3084\u3063\u3066\u3044\u308b\u306e\u306f\u3001\u4ee5\u4e0b\u306e\u3068\u304a\u308a\u3067\u3059\u3002<\/p>\n<ol>\n<li>\u73fe\u5728\u4f5c\u696d\u3057\u3066\u3044\u308b\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8\u3092\u53d6\u5f97<\/li>\n<li>\u305d\u306e\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8\u306e ID \u3092\u53d6\u5f97<\/li>\n<li>\u540c\u671f\u3057\u305f\u3044\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8\u306e ID \u3068\u4e00\u81f4\u3059\u308c\u3070\u30a6\u30a7\u30d6\u30d5\u30c3\u30af\uff08HTTP\u30ea\u30af\u30a8\u30b9\u30c8\uff09\u3092\u9001\u4fe1<\/li>\n<\/ol>\n<p>\u203b \u306a\u304a\u3001\u3053\u306e\u30b3\u30fc\u30c9\u5185\u306b\u3042\u308b\u300c<strong>\uff08\u3042\u306a\u305f\u306e\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8ID\uff09<\/strong>\u300d\u300c<strong>\uff08\u3042\u306a\u305f\u306e\u30c9\u30e1\u30a4\u30f3\uff09<\/strong>\u300d\u306f\u305d\u308c\u305e\u308c\u3042\u306a\u305f\u306e\u74b0\u5883\u306b\u5408\u308f\u305b\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u3061\u306a\u307f\u306b\u3001\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8ID\u306e\u53d6\u5f97\u65b9\u6cd5\u306f\u4ee5\u4e0b\u306e\u8a18\u4e8b\u3092\u53c2\u8003\u306b\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p><strong>\ud83d\udcdd \u53c2\u8003\u8a18\u4e8b\uff1a<\/strong>\u00a0<a href=\"https:\/\/blog.capilano-fw.com\/?p=1816#ID\" target=\"_blank\" rel=\"noopener\">\u4f5c\u6210\u3057\u305f\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8\u306eID\u3092\u53d6\u5f97\u3059\u308b<\/a><\/p>\n<\/div>\n<p>\u3053\u308c\u3067<code>Apps Script<\/code>\u306e\u4f5c\u696d\u306f\u5b8c\u4e86\u3067\u3059\u2757<\/p>\n<h1>\u30c8\u30ea\u30ac\u30fc\u3092\u8ffd\u52a0\u3059\u308b<\/h1>\n<p>\u6b21\u306b\u3001\u5148\u307b\u3069\u4fdd\u5b58\u3057\u305f<code>Apps Script<\/code>\u306b\u300c<strong>\u30c8\u30ea\u30ac\u30fc<\/strong>\u300d\u3068\u547c\u3070\u308c\u308b\u9023\u52d5\u6a5f\u80fd\u3092\u3064\u304f\u308a\u307e\u3059\u3002<\/p>\n<p>\u305d\u3057\u3066\u3001\u5b9f\u969b\u306b\u9023\u52d5\u3059\u308b\u6761\u4ef6\u306f\u300c<strong>\u30b7\u30fc\u30c8\u304c\u5909\u66f4\u3055\u308c\u305f\u3068\u304d<\/strong>\u300d\u3067\u3059\u3002<\/p>\n<p>\u3067\u306f\u3001\u30e1\u30cb\u30e5\u30fc\u304b\u3089\u300c<strong>\u30c8\u30ea\u30ac\u30fc<\/strong>\u300d\u3092\u30af\u30ea\u30c3\u30af\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-11450\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/03\/laravel_google_sheet_sync_5.png\" alt=\"\" width=\"284\" height=\"283\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/03\/laravel_google_sheet_sync_5.png 284w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/03\/laravel_google_sheet_sync_5-150x150.png 150w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/03\/laravel_google_sheet_sync_5-100x100.png 100w\" sizes=\"auto, (max-width: 284px) 100vw, 284px\" \/><\/p>\n<p>\u30da\u30fc\u30b8\u79fb\u52d5\u3057\u305f\u5148\u306e\u30da\u30fc\u30b8\u53f3\u4e0b\u306b\u3042\u308b\u300c<strong>\u30c8\u30ea\u30ac\u30fc\u3092\u8ffd\u52a0<\/strong>\u300d\u30dc\u30bf\u30f3\u3092\u30af\u30ea\u30c3\u30af\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-11449\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/03\/laravel_google_sheet_sync_6.png\" alt=\"\" width=\"196\" height=\"62\" \/><\/p>\n<p>\u3059\u308b\u3068\u30c8\u30ea\u30ac\u30fc\u3092\u8a2d\u5b9a\u3059\u308b\u30dd\u30c3\u30d7\u30a2\u30c3\u30d7\u304c\u8868\u793a\u3055\u308c\u308b\u306e\u3067\u305d\u306e\u4e2d\u304b\u3089\u4ee5\u4e0b\uff12\u3064\u3092\u5909\u66f4\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<ul>\n<li>\u5b9f\u884c\u3059\u308b\u95a2\u6570\u3092\u9078\u629e\uff1a onSheetUpdated\uff08\ud83d\udc48 Apps Script \u3067\u8a2d\u5b9a\u3057\u305f\u95a2\u6570\u3067\u3059\uff09<\/li>\n<li>\u30a4\u30d9\u30f3\u30c8\u306e\u7a2e\u985e\u3092\u9078\u629e\uff1a \u5909\u66f4\u6642<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-11448\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/03\/laravel_google_sheet_sync_7.png\" alt=\"\" width=\"302\" height=\"481\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/03\/laravel_google_sheet_sync_7.png 302w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/03\/laravel_google_sheet_sync_7-188x300.png 188w\" sizes=\"auto, (max-width: 302px) 100vw, 302px\" \/><\/p>\n<p>\u305d\u3057\u3066\u3001\u4fdd\u5b58\u30dc\u30bf\u30f3\u3092\u30af\u30ea\u30c3\u30af\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-11447\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/03\/laravel_google_sheet_sync_8.png\" alt=\"\" width=\"239\" height=\"80\" \/><\/p>\n<p>\u3059\u308b\u3068\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5b9f\u884c\u6a29\u9650\u3092\u4e0e\u3048\u308b\u30e6\u30fc\u30b6\u30fc\u304c\u8868\u793a\u3055\u308c\u308b\u306e\u3067\u30ed\u30b0\u30a4\u30f3\u3057\u3066\u3044\u308b\u3082\u306e\u3092\u9078\u629e\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-11445\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/03\/laravel_google_sheet_sync_9.png\" alt=\"\" width=\"567\" height=\"239\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/03\/laravel_google_sheet_sync_9.png 567w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/03\/laravel_google_sheet_sync_9-300x126.png 300w\" sizes=\"auto, (max-width: 567px) 100vw, 567px\" \/><\/p>\n<p>\u6700\u7d42\u78ba\u8a8d\u304c\u8868\u793a\u3055\u308c\u308b\u306e\u3067\u300c<strong>Advanced<\/strong>\u300d\u3092\u958b\u3044\u3066\u300c<strong>\uff08unsafe\uff09<\/strong>\u300d\u3068\u66f8\u304b\u308c\u305f\u30ea\u30f3\u30af\u3092\u30af\u30ea\u30c3\u30af\u3057\u307e\u3059\u3002<\/p>\n<p>\u203b \u5185\u5bb9\u3068\u3057\u3066\u306f\u300c\u30ea\u30b9\u30af\u3042\u308b\u3051\u3069\u30db\u30f3\u30c8\u306b OK \u306d\u2753\u300d\u3068\u3044\u3046\u3082\u306e\u3067\u3059\u3002\uff08\u3082\u3061\u308d\u3093\u81ea\u5df1\u8cac\u4efb\u3067\u3059\u304c\u3001\u30a6\u30a7\u30d6\u30d5\u30c3\u30af\u81ea\u4f53\u306f\u305d\u308c\u307b\u3069\u5371\u967a\u306a\u3082\u306e\u3067\u306f\u306a\u3044\u306e\u3067\u3054\u81ea\u8eab\u3067\u5224\u65ad\u3057\u3066\u304f\u3060\u3055\u3044\uff09<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-11444\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/03\/laravel_google_sheet_sync_10.png\" alt=\"\" width=\"591\" height=\"372\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/03\/laravel_google_sheet_sync_10.png 591w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/03\/laravel_google_sheet_sync_10-300x189.png 300w\" sizes=\"auto, (max-width: 591px) 100vw, 591px\" \/><\/p>\n<p>\u3059\u308b\u3068\u3001\u30c8\u30ea\u30ac\u30fc\u304c\u4fdd\u5b58\u3055\u308c\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u4e00\u89a7\u306b\u8868\u793a\u3055\u308c\u308b\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-11446\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/03\/laravel_google_sheet_sync_12.png\" alt=\"\" width=\"640\" height=\"188\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/03\/laravel_google_sheet_sync_12.png 640w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/03\/laravel_google_sheet_sync_12-300x88.png 300w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/p>\n<h1>Laravel \u5074\u306e\u4f5c\u696d<\/h1>\n<p>\u3067\u306f\u3001\u3053\u3053\u304b\u3089\u304c<code>Laravel<\/code>\uff08\u30a6\u30a7\u30d6\u30d5\u30c3\u30af\u3092\u53d7\u3051\u308b\u5074\uff09\u306e\u4f5c\u696d\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h1>Google Spreadsheet API \u304c\u4f7f\u3048\u308b\u3088\u3046\u306b\u3059\u308b<\/h1>\n<p>\u307e\u305a\u306f\u3001<code>Laravel<\/code>\u304b\u3089<code>Google Sheet<\/code>\u3078\u30a2\u30af\u30bb\u30b9\u3067\u304d\u308b\u3088\u3046\u306b\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u4ee5\u4e0b\u306e\u8a18\u4e8b\u3092\u3054\u89a7\u3044\u305f\u3060\u3044\u3066\u5148\u306b\u6e96\u5099\u3057\u3066\u304a\u3044\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p><strong>\ud83d\udcdd\u00a0\u53c2\u8003\u8a18\u4e8b<\/strong>\uff1a\u00a0<a href=\"https:\/\/blog.capilano-fw.com\/?p=1816#Google_API\" target=\"_blank\" rel=\"noopener\">Google API\u3067\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8\u3092\u6709\u52b9\u306b\u3059\u308b<\/a><\/p>\n<p>\u203b \u8a8d\u8a3c\u7528<code>JSON<\/code>\u306e\u30d5\u30a1\u30a4\u30eb\u540d\u3082\u3053\u306e\u30da\u30fc\u30b8\u306e\u3082\u306e\u3068\u4e00\u81f4\u3055\u305b\u3066\u3044\u307e\u3059\u3002\uff08<code>credentials.json<\/code>\uff09<\/p>\n<h1>\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b<\/h1>\n<p><code>Google<\/code>\u304c\u63d0\u4f9b\u3057\u3066\u304f\u308c\u3066\u3044\u308b<code>PHP<\/code>\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002<br \/>\n\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<div>\n<pre><strong>composer require google\/apiclient:^2.12.1<\/strong><\/pre>\n<h1>\u30e2\u30c7\u30eb\uff06\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u3092\u3064\u304f\u308b<\/h1>\n<p>\u7d9a\u3044\u3066\u3001<code>DB<\/code>\u307e\u308f\u308a\u306e\u4f5c\u696d\u3067\u3059\u3002<br \/>\n\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<div>\n<pre><strong>php artisan make:model Food -m<\/strong><\/pre>\n<p>\u3059\u308b\u3068\u3001\u30e2\u30c7\u30eb\u3068\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u306e\uff12\u30d5\u30a1\u30a4\u30eb\u304c\u4e00\u6c17\u306b\u4f5c\u6210\u3055\u308c\u308b\u306e\u3067\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n<\/div>\n<p><strong>app\/Models\/Food.php<\/strong><\/p>\n<div>\n<pre>&lt;?php\r\n\r\nnamespace App\\Models;\r\n\r\nuse Illuminate\\Database\\Eloquent\\Factories\\HasFactory;\r\nuse Illuminate\\Database\\Eloquent\\Model;\r\n\r\nclass Food extends Model\r\n{\r\n    use HasFactory;\r\n\r\n    <strong>protected $guarded = ['id']; \/\/ \ud83d\udc48 Mass assignment \u30a8\u30e9\u30fc\u306b\u306a\u3089\u306a\u3044\u3088\u3046\u306b\u3057\u3066\u3044\u307e\u3059<\/strong>\r\n}<\/pre>\n<\/div>\n<p>\u305d\u3057\u3066\u3001\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u3067\u3059\u3002<\/p>\n<div>\n<p><strong>database\/migrations\/****_**_**_******_create_food_table.php<\/strong><\/p>\n<\/div>\n<div>\n<pre>\/\/ \u7701\u7565\r\n\r\npublic function up(): void\r\n{\r\n    <strong>Schema::create('food', function (Blueprint $table) {<\/strong>\r\n<strong>        $table-&gt;id();<\/strong>\r\n<strong>        $table-&gt;string('name')-&gt;comment('\u98df\u3079\u7269\u306e\u540d\u524d');<\/strong>\r\n<strong>        $table-&gt;unsignedInteger('quantity')-&gt;comment('\u6570\u91cf');<\/strong>\r\n<strong>        $table-&gt;timestamps();<\/strong>\r\n<strong>    });<\/strong>\r\n}\r\n\r\n\/\/ \u7701\u7565<\/pre>\n<p>\u3067\u306f\u3001\u3053\u306e\u72b6\u614b\u3067\u30de\u30a4\u30b0\u30ec\u30fc\u30b7\u30e7\u30f3\u3092\u5b9f\u884c\u3057\u3066\u304a\u3044\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<div>\n<pre><strong>php artisan migrate<\/strong><\/pre>\n<p>\u5b9f\u969b\u306e\u30c6\u30fc\u30d6\u30eb\u306f\u3053\u3046\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-11464\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/03\/laravel_google_sheet_sync_20.png\" alt=\"\" width=\"407\" height=\"263\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/03\/laravel_google_sheet_sync_20.png 407w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/03\/laravel_google_sheet_sync_20-300x194.png 300w\" sizes=\"auto, (max-width: 407px) 100vw, 407px\" \/><\/p>\n<\/div>\n<\/div>\n<\/div>\n<h1>\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u3092\u3064\u304f\u308b<\/h1>\n<p>\u6b21\u306b\u3001\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u3067\u3059\u3002<br \/>\n\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<div>\n<pre><strong>php artisan make:controller GoogleSheetController<\/strong><\/pre>\n<\/div>\n<p>\u3059\u308b\u3068\u3001\u30d5\u30a1\u30a4\u30eb\u304c\u4f5c\u6210\u3055\u308c\u308b\u306e\u3067\u3053\u306e\u4e2d\u8eab\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n<p><strong>app\/Http\/Controllers\/GoogleSheetController.php<\/strong><\/p>\n<div>\n<pre><strong>&lt;?php<\/strong>\r\n\r\n<strong>namespace App\\Http\\Controllers;<\/strong>\r\n\r\n<strong>use App\\Models\\Food;<\/strong>\r\n<strong>use Illuminate\\Http\\Request;<\/strong>\r\n<strong>use Google_Client;<\/strong>\r\n<strong>use Google_Service_Sheets;<\/strong>\r\n<strong>use Illuminate\\Support\\Str;<\/strong>\r\n\r\n<strong>class GoogleSheetController extends Controller<\/strong>\r\n<strong>{<\/strong>\r\n<strong>    const SPREADSHEET_ID = '\uff08\u3042\u306a\u305f\u306e\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8ID\uff09';<\/strong>\r\n<strong>    const MAX_ROW = 100000; \/\/ \u6700\u5927 100000 \u884c\u3092\u8aad\u307f\u53d6\u308b<\/strong>\r\n\r\n<strong>    public function webhook(Request $request): void<\/strong>\r\n<strong>    {<\/strong>\r\n<strong>        $spreadsheet_id = $request-&gt;spreadsheet_id;<\/strong>\r\n\r\n<strong>        if($spreadsheet_id !== self::SPREADSHEET_ID) {<\/strong>\r\n\r\n<strong>            abort(400, '\u4e0d\u6b63\u306a\u30a2\u30af\u30bb\u30b9\u3067\u3059');<\/strong>\r\n\r\n<strong>        }<\/strong>\r\n\r\n<strong>        $sheet = $this-&gt;getSheetClient();<\/strong>\r\n\r\n<strong>        $range = 'A1:B'. self::MAX_ROW;<\/strong>\r\n<strong>        $response = $sheet-&gt;spreadsheets_values-&gt;get(self::SPREADSHEET_ID, $range);<\/strong>\r\n<strong>        $sheet_data = $response-&gt;getValues();<\/strong>\r\n<strong>        $existing_food_ids = [];<\/strong>\r\n\r\n<strong>        foreach ($sheet_data as $index =&gt; $row) {<\/strong>\r\n\r\n<strong>            if($index === 0) continue; \/\/ 1\u884c\u76ee\u306f\u30d8\u30c3\u30c0\u30fc\u306a\u306e\u3067\u30b9\u30ad\u30c3\u30d7<\/strong>\r\n\r\n<strong>            $name = data_get($row, 0, '');<\/strong>\r\n<strong>            $quantity = data_get($row, 1, '');<\/strong>\r\n\r\n<strong>            if(Str::length($name) &gt; 0 &amp;&amp; Str::length($quantity) &gt; 0) {<\/strong>\r\n\r\n<strong>                $food = Food::firstOrNew(['name' =&gt; $name]);<\/strong>\r\n<strong>                $food-&gt;quantity = $quantity;<\/strong>\r\n<strong>                $food-&gt;save();<\/strong>\r\n\r\n<strong>                $existing_food_ids[] = $food-&gt;id;<\/strong>\r\n\r\n<strong>            }<\/strong>\r\n\r\n<strong>        }<\/strong>\r\n\r\n<strong>        if(count($existing_food_ids) &gt; 0) {<\/strong>\r\n\r\n<strong>            Food::whereNotIn('id', $existing_food_ids)-&gt;delete();<\/strong>\r\n\r\n<strong>        }<\/strong>\r\n<strong>    }<\/strong>\r\n\r\n<strong>    private function getSheetClient(): Google_Service_Sheets<\/strong>\r\n<strong>    {<\/strong>\r\n<strong>        $credentials_path = storage_path('app\/json\/credentials.json');<\/strong>\r\n\r\n<strong>        $client = new Google_Client();<\/strong>\r\n<strong>        $client-&gt;setAuthConfig($credentials_path);<\/strong>\r\n<strong>        $client-&gt;setScopes([<\/strong>\r\n<strong>            Google_Service_Sheets::SPREADSHEETS,<\/strong>\r\n<strong>        ]);<\/strong>\r\n\r\n<strong>        return new Google_Service_Sheets($client);<\/strong>\r\n<strong>    }<\/strong>\r\n<strong>}<\/strong><\/pre>\n<\/div>\n<p>\u3053\u306e\u4e2d\u3067\u306f\u3001\u307e\u305a\u300c<strong>\u30b7\u30fc\u30c8\u304b\u3089\u30c7\u30fc\u30bf\u3092\u53d6\u3063\u3066\u304d\u3066\u3001DB\u306e\u30c7\u30fc\u30bf\u3092\u66f4\u65b0\uff08or \u65b0\u898f\u4f5c\u6210\uff09<\/strong>\u300d\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u203b \u306a\u304a\u3001\u4eca\u56de\u306f\u30d0\u30ea\u30c7\u30fc\u30b7\u30e7\u30f3\u306f\u3059\u3054\u304f\u30e6\u30eb\u304f\u306a\u3063\u3066\u3044\u307e\u3059\u304c\u3001\u672c\u756a\u74b0\u5883\u306e\u5834\u5408\u306f\u578b\u306a\u3069\u3082\u30c1\u30a7\u30c3\u30af\u3059\u308b\u3053\u3068\u3092\u304a\u3059\u3059\u3081\u3057\u307e\u3059\u3002<\/p>\n<p>\u306a\u304a\u3001\uff11\u70b9\u3060\u3051\u5c11\u3057\u30c8\u30ea\u30c3\u30ad\u30fc\u306a\u306e\u304c\u3001<code>$existing_food_ids<\/code>\u306e\u90e8\u5206\u3067\u3059\u3002<\/p>\n<p>\u3053\u308c\u306f\u300c<strong>\u5b58\u5728\u3057\u3066\u3044\u308b\u30c7\u30fc\u30bf\u5168\u3066\u306eID<\/strong>\u300d\u306a\u306e\u3067\u3059\u304c\u3001\u76ee\u7684\u3068\u3057\u3066\u306f\u300c<strong>\u305d\u308c\u4ee5\u5916\u306e\u30c7\u30fc\u30bf\u3092\u524a\u9664\u3059\u308b\u305f\u3081<\/strong>\u300d\u3067\u3059\u3002<\/p>\n<p>\u3068\u3044\u3046\u306e\u3082\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8\u306b\u3042\u308b\u3068\u3057\u307e\u3059\u3002<\/p>\n<ul>\n<li>\u30e9\u30fc\u30e1\u30f3\uff1a\uff11<\/li>\n<li>\u30ab\u30ec\u30fc\uff1a\uff12<\/li>\n<li>\u304a\u5bff\u53f8\uff1a\uff13<\/li>\n<\/ul>\n<p>\u305d\u3057\u3066\u3001\u3053\u306e\u72b6\u614b\u3067\u30ab\u30ec\u30fc\u306e\u884c\u3092\u6d88\u3057\u3066\u3057\u307e\u3063\u305f\u5834\u5408\u3069\u3046\u306a\u308b\u3067\u3057\u3087\u3046\u304b\u3002<\/p>\n<ul>\n<li>\u30e9\u30fc\u30e1\u30f3\uff1a\uff11<\/li>\n<li>\u304a\u5bff\u53f8\uff1a\uff13<\/li>\n<\/ul>\n<p>\u30a6\u30a7\u30d6\u30d5\u30c3\u30af\u5074\u3068\u3059\u308b\u3068\u3001\u300c<strong>\u524a\u9664\u3055\u308c\u305f\u98df\u3079\u3082\u306e\u304c\u4f55\u306a\u306e\u304b<\/strong>\u300d\u3092\u77e5\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u305b\u3093\u3002<\/p>\n<p>\u305d\u306e\u305f\u3081\u3001\u300c<strong>\u5b58\u5728\u3057\u3066\u3044\u308b\u3082\u306e\u306e\u9006\uff08\uff1d\u5b58\u5728\u3057\u3066\u3044\u306a\u3044\u3082\u306e\uff09\u3092\u524a\u9664\u3059\u308b<\/strong>\u300d\u3068\u3044\u3046\u30a2\u30d7\u30ed\u30fc\u30c1\u306b\u3057\u3066\u3044\u308b\u306e\u3067\u3059\u3002<\/p>\n<p>\u307e\u305f\u3001<strong>\uff08\u3042\u306a\u305f\u306e\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8ID\uff09<\/strong>\u306e\u90e8\u5206\u306f\u5148\u307b\u3069\u306e<code>Apps Script<\/code>\u540c\u69d8\u3054\u81ea\u8eab\u306e\u3082\u306e\u3078\u5909\u66f4\u3057\u3066\u304a\u3044\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<h1>\u30eb\u30fc\u30c8\u3092\u3064\u304f\u308b<\/h1>\n<p>\u305d\u3057\u3066\u3001\u30eb\u30fc\u30c8\u3067\u3059\u3002<\/p>\n<p><strong>routes\/web.php<\/strong><\/p>\n<div>\n<pre>\/\/ \u7701\u7565\r\n\r\n<strong>use App\\Http\\Controllers\\GoogleSheetController;<\/strong>\r\n\r\n\/\/ \u7701\u7565\r\n\r\n<strong>Route::post('google_sheet\/webhook', [GoogleSheetController::class, 'webhook'])-&gt;name('google_sheet.webhook');<\/strong><\/pre>\n<\/div>\n<h1>CSRF \u5236\u9650\u3092\u89e3\u9664\u3059\u308b<\/h1>\n<p><code>Laravel<\/code>\u306f\u3001\u521d\u671f\u72b6\u614b\u3067<code>CSRF<\/code>\u653b\u6483\uff08\u30af\u30ed\u30b9\u30b5\u30a4\u30c8\u30fb\u30ea\u30af\u30a8\u30b9\u30c8\u30fb\u30d5\u30a9\u30fc\u30b8\u30a7\u30ea\uff09\u3092\u30d6\u30ed\u30c3\u30af\u3059\u308b\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u308b\u306e\u3067\u3059\u304c\u3001\u3053\u308c\u304c\u3042\u308b\u3068\u30a6\u30a7\u30d6\u30d5\u30c3\u30af\u307e\u3067\u30d6\u30ed\u30c3\u30af\u3055\u308c\u3066\u3057\u307e\u3044\u307e\u3059\u3002<\/p>\n<p>\u305d\u306e\u305f\u3081\u3001\u4eca\u56de\u30a6\u30a7\u30d6\u30d5\u30c3\u30af\u3068\u3057\u3066\u5229\u7528\u3059\u308b\u300c<strong>http:\/\/****\/google_sheet\/webhook<\/strong>\u300d\u306f\u305d\u306e\u5236\u9650\u3092\u89e3\u9664\u3057\u3066\u304a\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<p><strong>app\/Http\/Middleware\/VerifyCsrfToken.php<\/strong><\/p>\n<div>\n<pre><strong>&lt;?php<\/strong>\r\n\r\n<strong>namespace App\\Http\\Middleware;<\/strong>\r\n\r\n<strong>use Illuminate\\Foundation\\Http\\Middleware\\VerifyCsrfToken as Middleware;<\/strong>\r\n\r\n<strong>class VerifyCsrfToken extends Middleware<\/strong>\r\n<strong>{<\/strong>\r\n<strong>    \/**<\/strong>\r\n<strong>     * The URIs that should be excluded from CSRF verification.<\/strong>\r\n<strong>     *<\/strong>\r\n<strong>     * @var array&lt;int, string&gt;<\/strong>\r\n<strong>     *\/<\/strong>\r\n<strong>    protected $except = [<\/strong>\r\n<strong>        'google_sheet\/webhook', \/\/ \ud83d\udc48 \u3053\u3053\u3092\u8ffd\u52a0\u3057\u307e\u3057\u305f<\/strong>\r\n<strong>    ];<\/strong>\r\n<strong>}<\/strong><\/pre>\n<\/div>\n<p>\u203b \u3061\u306a\u307f\u306b\u3001<code>CSRF<\/code>\u653b\u6483\u306e\u8a73\u7d30\u306f\u4ee5\u4e0b\u306e\u8a18\u4e8b\u3092\u3054\u89a7\u304f\u3060\u3055\u3044\u3002<\/p>\n<p><strong>\ud83d\udcdd\u00a0\u53c2\u8003\u8a18\u4e8b<\/strong>\uff1a\u00a0<a href=\"https:\/\/blog.capilano-fw.com\/?p=4325\" target=\"_blank\" rel=\"noopener\">CSRF\uff08\u30af\u30ed\u30b9\u30b5\u30a4\u30c8\u30fb\u30ea\u30af\u30a8\u30b9\u30c8\u30fb\u30d5\u30a9\u30fc\u30b8\u30a7\u30ea\uff09\u653b\u6483\u3092\u3067\u304d\u308b\u3060\u3051\u5206\u304b\u308a\u3084\u3059\u304f\u89e3\u8aac<\/a><\/p>\n<p>\u3053\u308c\u3067\u4f5c\u696d\u306f\u3059\u3079\u3066\u5b8c\u4e86\u3067\u3059\u2757<br \/>\n\u304a\u75b2\u308c\u69d8\u3067\u3057\u305f\u3002\ud83d\ude04\u2728<\/p>\n<h1>\u30c6\u30b9\u30c8\u3057\u3066\u307f\u308b<\/h1>\n<p>\u3067\u306f\u3001\u5b9f\u969b\u306b<code>Laravel<\/code>\u3092\u30b5\u30fc\u30d0\u30fc\u3078\u8a2d\u7f6e\u3057\u3066\u30c6\u30b9\u30c8\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u2757<\/p>\n<p>\u307e\u305a\u306f\u3001\u4f55\u3082\u3057\u3066\u3044\u306a\u3044\u72b6\u614b\u306e\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306f\u3053\u3046\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-11455\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/03\/laravel_google_sheet_sync_13.png\" alt=\"\" width=\"533\" height=\"299\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/03\/laravel_google_sheet_sync_13.png 533w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/03\/laravel_google_sheet_sync_13-300x168.png 300w\" sizes=\"auto, (max-width: 533px) 100vw, 533px\" \/><\/p>\n<p>\u3067\u306f\u3001\u3053\u306e\u72b6\u614b\u3067\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5909\u66f4\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-11456\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/03\/laravel_google_sheet_sync_14.png\" alt=\"\" width=\"315\" height=\"298\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/03\/laravel_google_sheet_sync_14.png 315w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/03\/laravel_google_sheet_sync_14-300x284.png 300w\" sizes=\"auto, (max-width: 315px) 100vw, 315px\" \/><\/p>\n<p>\u3059\u308b\u3068\u3001DB\u306f\u30fb\u30fb\u30fb\u30fb\u30fb\u30fb<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-11457\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/03\/laravel_google_sheet_sync_15.png\" alt=\"\" width=\"527\" height=\"376\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/03\/laravel_google_sheet_sync_15.png 527w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/03\/laravel_google_sheet_sync_15-300x214.png 300w\" sizes=\"auto, (max-width: 527px) 100vw, 527px\" \/><\/p>\n<p>\u306f\u3044\u2757<br \/>\n<code>DB<\/code>\u306f\u4f55\u3082\u89e6\u3063\u3066\u3044\u307e\u305b\u3093\u304c\u3001\u81ea\u52d5\u3067\u540c\u671f\u3055\u308c\u307e\u3057\u305f\u3002<\/p>\n<p>\u307e\u305a\u306f\u6210\u529f\u3067\u3059\ud83d\ude04<\/p>\n<p>\u3067\u306f\u3001\u6b21\u306b\u300c<strong>\u30ab\u30ec\u30fc\u3046\u3069\u3093<\/strong>\u300d\u3092\u300c<strong>99\u500b<\/strong>\u300d\u3067\u8ffd\u52a0\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-11458\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/03\/laravel_google_sheet_sync_16.png\" alt=\"\" width=\"285\" height=\"219\" \/><\/p>\n<p><code>DB<\/code>\u306f\u3069\u3046\u306a\u3063\u305f\u3067\u3057\u3087\u3046\u304b\u30fb\u30fb\u30fb\u30fb\u30fb\u30fb<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-11459\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/03\/laravel_google_sheet_sync_17.png\" alt=\"\" width=\"534\" height=\"202\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/03\/laravel_google_sheet_sync_17.png 534w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/03\/laravel_google_sheet_sync_17-300x113.png 300w\" sizes=\"auto, (max-width: 534px) 100vw, 534px\" \/><\/p>\n<p>\u306f\u3044\u2757<br \/>\n\u30ab\u30ec\u30fc\u3046\u3069\u3093\u3082<code>DB<\/code>\u306b\u8ffd\u52a0\u3055\u308c\u307e\u3057\u305f\ud83d\udc4d<\/p>\n<p>\u3067\u306f\u3001\u6700\u5f8c\u306b\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8\u304b\u3089\u300c<strong>\u30cf\u30f3\u30d0\u30fc\u30b0<\/strong>\u300d\u3092\u524a\u9664\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-11460\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/03\/laravel_google_sheet_sync_18.png\" alt=\"\" width=\"296\" height=\"236\" \/><\/p>\n<p>\u3046\u307e\u304f\u524a\u9664\u3055\u308c\u308b\u3067\u3057\u3087\u3046\u304b\u30fb\u30fb\u30fb\u30fb\u30fb\u30fb<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-11461\" style=\"border: 3px solid #000;\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/03\/laravel_google_sheet_sync_19.png\" alt=\"\" width=\"533\" height=\"179\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/03\/laravel_google_sheet_sync_19.png 533w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2023\/03\/laravel_google_sheet_sync_19-300x101.png 300w\" sizes=\"auto, (max-width: 533px) 100vw, 533px\" \/><\/p>\n<p>\u306f\u3044\u2757<br \/>\n\uff14\u756a\u306e\u30cf\u30f3\u30d0\u30fc\u30b0\u304c\u81ea\u52d5\u3067\u524a\u9664\u3055\u308c\u307e\u3057\u305f\u3002<\/p>\n<p>\u3059\u3079\u3066\u6210\u529f\u3067\u3059\u2728\ud83d\ude04\ud83d\udc4d<\/p>\n<h1>\u4f01\u696d\u69d8\u3078\u306e\u3054\u63d0\u6848<\/h1>\n<p><code>Google Sheet<\/code>\u306f\u4eca\u3084<code>Microsoft Excel<\/code>\u3068\u4e26\u3093\u3067\u591a\u304f\u306e\u4eba\u306b\u5229\u7528\u3055\u308c\u3066\u3044\u308b\u8868\u8a08\u7b97\u30b7\u30b9\u30c6\u30e0\u3067\u3059\u3002<\/p>\n<p>\u305d\u3057\u3066\u3001\u30a6\u30a7\u30d6\u30b7\u30b9\u30c6\u30e0\u3068<code>Google Sheet<\/code>\u3092\u7d71\u5408\u3055\u305b\u308b\u3053\u3068\u3067\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30e1\u30ea\u30c3\u30c8\u304c\u8003\u3048\u3089\u308c\u307e\u3059\u3002<\/p>\n<ul>\n<li>\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u89e6\u308b\u306e\u306f\u6016\u3044\uff08\u77e5\u8b58\u304c\u306a\u3044\uff09\u30b9\u30bf\u30c3\u30d5\u3055\u3093\u3067\u3082 Google Sheet \u3092\u64cd\u4f5c\u3059\u308b\u3060\u3051\u3067\u30c7\u30fc\u30bf\u306e\u5909\u66f4\u304c\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308b<\/li>\n<li>Google Sheet \u306f\u3001\u30c7\u30fc\u30bf\u306e\u30b3\u30d4\u30fc\u306a\u3069\u304c\u5bb9\u6613\u306a\u305f\u3081\u3001\u751f\u7523\u6027\u3092\u5411\u4e0a\u3055\u305b\u308b\u3053\u3068\u304c\u3067\u304d\u308b<\/li>\n<li>Google Sheet \u306f\u3001\u30e2\u30d0\u30a4\u30eb\u30a2\u30d7\u30ea\u306a\u3069\u3082\u63d0\u4f9b\u3055\u308c\u3066\u3044\u308b\u305f\u3081\u3001\u3044\u308d\u3093\u306a\u74b0\u5883\u304b\u3089\u30c7\u30fc\u30bf\u5909\u66f4\u304c\u3057\u3084\u3059\u3044\u3067\u3059\u3002\u305d\u3057\u3066\u3001\u305d\u306e\u30c7\u30fc\u30bf\u5909\u66f4\u6642\u306b\u4eca\u56de\u306e\u3088\u3046\u306a\u30c8\u30ea\u30ac\u30fc\uff06\u30a6\u30a7\u30d6\u30d5\u30c3\u30af\u3092\u4ed5\u8fbc\u3080\u3053\u3068\u3067\u3088\u308a\u300c\u3044\u3064\u3067\u3082\u3069\u3053\u3067\u3082\u300d\u30a6\u30a7\u30d6\u30b7\u30b9\u30c6\u30e0\u3092\u64cd\u4f5c\u3059\u308b\u3053\u3068\u304c\u53ef\u80fd\u306b\u306a\u308a\u307e\u3059\u3002<\/li>\n<\/ul>\n<p>\u3082\u3057\u3053\u3046\u3044\u3063\u305f\u6a5f\u80fd\u3092\u3054\u5e0c\u671b\u3067\u3057\u305f\u3089\u304a\u6c17\u8efd\u306b\u304a\u554f\u3044\u5408\u308f\u305b\u304b\u3089\u3054\u76f8\u8ac7\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u304a\u5f85\u3061\u3057\u3066\u304a\u308a\u307e\u3059\u3002\ud83d\ude04\u2728<\/p>\n<h1>\u304a\u308f\u308a\u306b<\/h1>\n<p>\u3068\u3046\u3053\u3068\u3067\u3001\u4eca\u56de\u306f<code>Laravel<\/code>\u3067<code>Google Sheet<\/code>\u306e\u30a6\u30a7\u30d6\u30d5\u30c3\u30af\u3092\u3064\u304f\u3063\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p>\u5b9f\u306f\u6700\u521d\u3001<code>Apps Script<\/code>\u304c\u6a19\u6e96\u3067\u7528\u610f\u3057\u3066\u304f\u308c\u3066\u3044\u308b<code>onSelectionChange<\/code>\u3068\u3044\u3046\u30a4\u30d9\u30f3\u30c8\u3092\u4f7f\u304a\u3046\u3068\u3057\u3066\u3044\u305f\u306e\u3067\u3059\u304c\u3001\u3069\u3046\u3084\u3089\u3053\u306e\u30a4\u30d9\u30f3\u30c8\u306f\u6a29\u9650\u3092\u4ed8\u4e0e\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u306a\u3044\u305f\u3081\u3001\u72ec\u81ea\u306e\u540d\u524d\u306b\u5909\u66f4\u3057\u3001\u72ec\u81ea\u306e\u30c8\u30ea\u30ac\u30fc\u3092\u30bb\u30c3\u30c8\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u3068\u306e\u3053\u3068\u3067\u3061\u3087\u3063\u3068\u3042\u305b\u308a\u307e\u3057\u305f\u3002\uff08\u305d\u306e\u6642\u70b9\u3067\u3053\u306e\u8a18\u4e8b\u306f80%\u3050\u3089\u3044\u3067\u304d\u3066\u305f\u3093\u3067\u3059\u3088\u306d\u2026\ud83d\udca6\uff09<\/p>\n<p>\u6b63\u76f4\u904e\u53bb\u306b\u3082\u300c\u307b\u3068\u3093\u3069\u3067\u304d\u3066\u305f\u3051\u3069\u81f4\u547d\u7684\u306a\u7a74\u304c\u3042\u3063\u3066\u304a\u8535\u5165\u308a\u306b\u3057\u305f\u300d\u8a18\u4e8b\u304c\u3044\u304f\u3064\u304b\u3042\u3063\u3066\u3001\u305d\u3093\u306a\u3053\u3068\u3082\u3042\u3063\u3066\u304b\u30d6\u30ed\u30b0\u8a18\u4e8b\u3092\u7d9a\u3051\u308b\u306e\u306f\u96e3\u3057\u3044\u3067\u3059\u306d\u3002\uff08\u3084\u306f\u308a\u300c<strong>\u597d\u304d\u3060\u304b\u3089\u3084\u3063\u3066\u308b<\/strong>\u300d\u3068\u3044\u3046\u5fc3\u69cb\u3048\u304c\u4e00\u756a\u3044\u3044\u3088\u3046\u306a\u6c17\u304c\u3057\u307e\u3059\uff09<\/p>\n<p>\u305c\u3072\u7686\u3055\u3093\u3082\u30c1\u30e3\u30ec\u30f3\u30b8\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u306d\u3002<\/p>\n<p>\u3067\u306f\u3067\u306f\u301c\u2757<\/p>\n<p style=\"text-align: center;\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4445 aligncenter\" src=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/08\/no_2.png\" alt=\"\" width=\"370\" height=\"310\" srcset=\"https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/08\/no_2.png 370w, https:\/\/blog.capilano-fw.com\/wp-content\/uploads\/2019\/08\/no_2-300x251.png 300w\" sizes=\"auto, (max-width: 370px) 100vw, 370px\" \/>\u300c\u304a\u4ed5\u4e8b\u3067 Livewire \u4f7f\u308f\u305b\u3066<br \/>\n\u3082\u3089\u3063\u3066\u307e\u3059\ud83d\ude04\ud83d\udc4d\u300d<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3055\u3066\u3055\u3066\u3001\u79c1\u3082\u9577\u3089\u304f\u958b\u767a\u306e\u304a\u4ed5\u4e8b\u3092\u3055\u305b\u3066\u3044\u305f\u3060\u3044\u3066\u3044\u308b\u306e\u3067\u3059\u304c\u3001\u6700\u8fd1 \u300c\u3042\u2757\u3053\u308c\u306f\u6c17\u3092\u3064\u3051\u306a\u3044\u3068\u300d \u3068\u611f\u3058\u308b\u3053\u3068\u304c\u3042\u308a\u307e\u3057\u305f\u3002 \u8a73\u7d30\u306f\u8a71\u305b\u307e\u305b\u3093\u304c\u3001\u3042\u308b\u3068\u304d\u300c\u76f4 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/blog.capilano-fw.com\/?p=11440\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;\u3010Laravel\u3011Google sheet \u3068 DB \u3092\u540c\u671f\u3059\u308b\uff08Apps Script\uff09&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":11466,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-11440","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-laravel"],"_links":{"self":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/11440","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=11440"}],"version-history":[{"count":6,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/11440\/revisions"}],"predecessor-version":[{"id":11467,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/posts\/11440\/revisions\/11467"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=\/wp\/v2\/media\/11466"}],"wp:attachment":[{"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=11440"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=11440"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.capilano-fw.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=11440"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}