{"id":329,"date":"2025-05-29T00:56:46","date_gmt":"2025-05-28T15:56:46","guid":{"rendered":"https:\/\/cg-method.com\/google\/?p=329"},"modified":"2025-05-29T00:56:46","modified_gmt":"2025-05-28T15:56:46","slug":"gas-skip-on-holidays","status":"publish","type":"post","link":"https:\/\/cg-method.com\/google\/gas-skip-on-holidays\/","title":{"rendered":"GAS\u2502\u795d\u65e5\u30fb\u4f11\u65e5\u30fb\u6307\u5b9a\u3057\u305f\u65e5\u306f\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u30b9\u30ad\u30c3\u30d7\u3059\u308b\u65b9\u6cd5\u2502Google\u30ab\u30ec\u30f3\u30c0\u30fc\u9023\u643a"},"content":{"rendered":"\n<p>\u6bce\u65e5\u30eb\u30fc\u30c6\u30a3\u30f3\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u52d5\u304b\u3057\u3066\u3044\u308b\u3068\u3001\u571f\u65e5\u3084\u795d\u65e5\u3001\u7279\u5b9a\u306e\u4f11\u696d\u65e5\u306a\u3069\u306b\u306f\u5b9f\u884c\u3092\u30b9\u30ad\u30c3\u30d7\u3057\u305f\u3044\u5834\u9762\u304c\u3042\u308a\u307e\u3059\u3088\u306d\u3002<\/p>\n\n\n\n<p>\u4eca\u56de\u306f Google Apps Script\uff08GAS\uff09\u3067\u3001\u300c\u795d\u65e5\uff0b\u6307\u5b9a\u65e5\u300d\u306e\u4e21\u65b9\u306b\u5bfe\u5fdc\u3057\u3066\u30b9\u30af\u30ea\u30d7\u30c8\u5b9f\u884c\u3092\u30b9\u30ad\u30c3\u30d7\u3059\u308b\u65b9\u6cd5\u3092\u30e1\u30e2\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u30b9\u30af\u30ea\u30d7\u30c8\u306e\u57fa\u672c\u69cb\u9020<\/h2>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-js\" data-lang=\"JavaScript\"><code>function isBusinessDay(date){\n  if (date.getDay() == 0 || date.getDay() == 6) return false; \/\/ \u571f\u65e5\n  var calJa = CalendarApp.getCalendarById(&#39;ja.japanese#holiday@group.v.calendar.google.com&#39;);\n  return calJa.getEventsForDay(date).length === 0;\n}\n\nfunction myFunction() {\n  var date = new Date();  \n  if (isBusinessDay(date)) {\n    Logger.log(&#39;\u9001\u4fe1&#39;);\n  } else {\n    Logger.log(&#39;\u4f11\u65e5&#39;);\n  }\n}\n<\/code><\/pre><\/div>\n\n\n\n<p>\u4e0a\u8a18\u306f\u300c<strong>\u571f\u65e5\uff0b\u65e5\u672c\u306e\u795d\u65e5<\/strong>\u300d\u3092\u30b9\u30ad\u30c3\u30d7\u5bfe\u8c61\u3068\u3059\u308b\u4f8b\u3067\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u3055\u3089\u306b\u300c\u6307\u5b9a\u3057\u305f\u65e5\u300d\u3082\u9664\u5916\u3057\u305f\u3044\u3068\u304d<\/h2>\n\n\n\n<p>\u4f8b\u3048\u3070\u3001<strong>\u793e\u5185\u6307\u5b9a\u4f11\u65e5\u3084\u30b7\u30b9\u30c6\u30e0\u30e1\u30f3\u30c6\u30ca\u30f3\u30b9\u65e5<\/strong>\u306a\u3069\u3082\u9664\u5916\u5bfe\u8c61\u306b\u3057\u305f\u3044\u5834\u5408\u306f\u3001\u4ee5\u4e0b\u306e\u65b9\u6cd5\u3067\u5bfe\u5fdc\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1. Google\u30ab\u30ec\u30f3\u30c0\u30fc\u3092\u6e96\u5099<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Google \u30ab\u30ec\u30f3\u30c0\u30fc\u3092\u65b0\u898f\u4f5c\u6210<\/li>\n\n\n\n<li>\u30b9\u30ad\u30c3\u30d7\u3057\u305f\u3044\u65e5\u4ed8\u306b\u300c\u4e88\u5b9a\u300d\u3092\u5165\u308c\u308b\uff08\u30bf\u30a4\u30c8\u30eb\u306f\u4f55\u3067\u3082OK\uff09<\/li>\n\n\n\n<li>\u30ab\u30ec\u30f3\u30c0\u30fc\u6a2a\u306e\u300c\ufe19\u300d\u30e1\u30cb\u30e5\u30fc\u304b\u3089\u300c\u8a2d\u5b9a\u3068\u5171\u6709\u300d\u3092\u958b\u304d\u3001\u300c\u30ab\u30ec\u30f3\u30c0\u30fcID\u300d\u3092\u30b3\u30d4\u30fc<br>\u4f8b\uff09<code>hogehoge@group.calendar.google.com<\/code><\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">2. \u30b9\u30af\u30ea\u30d7\u30c8\u306b\u6307\u5b9a\u65e5\u30c1\u30a7\u30c3\u30af\u3092\u8ffd\u52a0<\/h3>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-js\" data-lang=\"JavaScript\"><code>function isBusinessDay(date){\n  if (date.getDay() == 0 || date.getDay() == 6) return false;\n  var calJa = CalendarApp.getCalendarById(&#39;ja.japanese#holiday@group.v.calendar.google.com&#39;);\n  return calJa.getEventsForDay(date).length === 0;\n}\n\nfunction isSpecifiedDay(date){\n  var calCustom = CalendarApp.getCalendarById(&#39;hogehoge@group.calendar.google.com&#39;); \/\/ \u3042\u306a\u305f\u306e\u30ab\u30ec\u30f3\u30c0\u30fcID\u306b\u7f6e\u304d\u63db\u3048\n  return calCustom.getEventsForDay(date).length === 0;\n}\n\nfunction myFunction() {\n  var date = new Date();  \n  if (isSpecifiedDay(date)) {\n    if (isBusinessDay(date)) {\n      Logger.log(&#39;\u9001\u4fe1\uff01&#39;);\n    } else {\n      Logger.log(&#39;\u4f11\u65e5&#39;);\n    }\n  } else {\n    Logger.log(&#39;\u6307\u5b9a\u65e5\u4f11\u65e5&#39;);\n  }\n}<\/code><\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">\u307e\u3068\u3081<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u65e5\u672c\u306e\u795d\u65e5\u306f <code>ja.japanese#holiday@group.v.calendar.google.com<\/code> \u3092\u4f7f\u7528<\/li>\n\n\n\n<li>\u4efb\u610f\u306e\u6307\u5b9a\u65e5\u306f\u72ec\u81ea\u30ab\u30ec\u30f3\u30c0\u30fc\u3092\u4f5c\u6210\u3057\u3001\u305d\u306eID\u3067\u7ba1\u7406<\/li>\n\n\n\n<li><code>getEventsForDay(date).length<\/code> \u3092\u4f7f\u3048\u3070\u5f53\u65e5\u306e\u30a4\u30d9\u30f3\u30c8\u6709\u7121\u3067\u5224\u5b9a\u53ef\u80fd<\/li>\n<\/ul>\n\n\n\n<p>\u696d\u52d9\u81ea\u52d5\u5316\u3084\u65e5\u6b21\u51e6\u7406\u3067\u3001<strong>\u300c\u4eca\u65e5\u306f\u51e6\u7406\u3057\u306a\u3044\u65e5\u3060\u306a\u300d\u3068\u601d\u3063\u305f\u3089\u81ea\u52d5\u3067\u6b62\u3081\u3066\u304f\u308c\u308b<\/strong>\u306e\u306f\u3068\u3066\u3082\u4fbf\u5229\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u30ab\u30ec\u30f3\u30c0\u30fc\u3067\u65e5\u4ed8\u3092\u7ba1\u7406\u3067\u304d\u308b\u306e\u3067\u3001<strong>\u30b3\u30fc\u30c9\u3092\u3044\u3058\u3089\u305a\u306b\u904b\u7528\u3067\u304d\u308b<\/strong>\u306e\u3082\u30dd\u30a4\u30f3\u30c8\u3002<\/p>\n\n\n\n<p>\u904b\u7528\u4e2d\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u306b\u305c\u3072\u7d44\u307f\u8fbc\u3093\u3067\u307f\u3066\u304f\u3060\u3055\u3044\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6bce\u65e5\u30eb\u30fc\u30c6\u30a3\u30f3\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u52d5\u304b\u3057\u3066\u3044\u308b\u3068\u3001\u571f\u65e5\u3084\u795d\u65e5\u3001\u7279\u5b9a\u306e\u4f11\u696d\u65e5\u306a\u3069\u306b\u306f\u5b9f\u884c\u3092\u30b9\u30ad\u30c3\u30d7\u3057\u305f\u3044\u5834\u9762\u304c\u3042\u308a\u307e\u3059\u3088\u306d\u3002 \u4eca\u56de\u306f Google Apps Script\uff08GAS\uff09\u3067\u3001\u300c\u795d\u65e5\uff0b\u6307\u5b9a\u65e5\u300d\u306e\u4e21\u65b9\u306b\u5bfe\u5fdc\u3057\u3066\u30b9\u30af\u30ea\u30d7\u30c8\u5b9f\u884c [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":330,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"swell_btn_cv_data":"","footnotes":""},"categories":[16],"tags":[18,9],"class_list":["post-329","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-web-applications","tag-gas","tag-free"],"_links":{"self":[{"href":"https:\/\/cg-method.com\/google\/wp-json\/wp\/v2\/posts\/329","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cg-method.com\/google\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cg-method.com\/google\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cg-method.com\/google\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cg-method.com\/google\/wp-json\/wp\/v2\/comments?post=329"}],"version-history":[{"count":1,"href":"https:\/\/cg-method.com\/google\/wp-json\/wp\/v2\/posts\/329\/revisions"}],"predecessor-version":[{"id":331,"href":"https:\/\/cg-method.com\/google\/wp-json\/wp\/v2\/posts\/329\/revisions\/331"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cg-method.com\/google\/wp-json\/wp\/v2\/media\/330"}],"wp:attachment":[{"href":"https:\/\/cg-method.com\/google\/wp-json\/wp\/v2\/media?parent=329"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cg-method.com\/google\/wp-json\/wp\/v2\/categories?post=329"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cg-method.com\/google\/wp-json\/wp\/v2\/tags?post=329"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}