{"id":1703,"date":"2020-10-30T13:00:00","date_gmt":"2020-10-30T04:00:00","guid":{"rendered":"https:\/\/google-apps-script.net\/instructions\/?p=1703"},"modified":"2021-06-16T22:12:35","modified_gmt":"2021-06-16T13:12:35","slug":"how-to-create-newconditionalformatrule-for-spreadsheets-by-gas","status":"publish","type":"post","link":"https:\/\/for-dummies.net\/gas-noobs\/how-to-create-newconditionalformatrule-for-spreadsheets-by-gas\/","title":{"rendered":"\u3010\u30b3\u30d4\u30da\u3067\u4f7f\u3048\u308b\u3011GAS\u3067\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8\u306e\u6761\u4ef6\u4ed8\u304d\u66f8\u5f0f\u3092\u4f5c\u6210\u3059\u308b"},"content":{"rendered":"<p>\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8\u3092\u4f5c\u6210\u3059\u308b\u969b\u306b\u7279\u5b9a\u306e\u6761\u4ef6\uff08\u7a7a\u767d\u3060\u3063\u305f\u3089\u8272\u3092\u3064\u3051\u308b\u3001\u3053\u306e\u6587\u5b57\u306e\u6642\u306f\u592a\u5b57\u306b\u3059\u308b\u306a\u3069\uff09\u3092\u8a2d\u5b9a\u3055\u305b\u305f\u3044\u6642\u304c\u3042\u308a\u307e\u3059\u3002\u8868\u793a\u5f62\u5f0f\u304b\u3089\u6761\u4ef6\u4ed8\u304d\u66f8\u5f0f\u3092\u30af\u30ea\u30c3\u30af\u3057\u3066\u6bce\u56de\u8a2d\u5b9a\u3059\u308b\u65b9\u6cd5\u3067\u3082\u3044\u3044\u306e\u3067\u3059\u304c\u6bce\u56de\u4f5c\u6210\u3059\u308b\u3088\u3046\u306a\u5831\u544a\u66f8\b\u306a\u3069\u306b\u540c\u3058\u8a2d\u5b9a\u3092\u624b\u52d5\u3067\u884c\u3046\u3068\u30df\u30b9\u304c\u767a\u751f\u3057\u305f\u308a\u4f5c\u696d\u6642\u9593\u304c\u304b\u304b\u3063\u3066\u3057\u307e\u3044\u307e\u3059\u3088\u306d\u3002<\/p>\n<p>\u305d\u3053\u3067\u4eca\u56de\u306f\u30b9\u30af\u30ea\u30d7\u30c8\u3067\u6761\u4ef6\u4ed8\u304d\u66f8\u5f0f\u3092\u8a2d\u5b9a\u3067\u304d\u308b\u30e1\u30bd\u30c3\u30c9\u3092\u3054\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n<p><!--more--><\/p>\n<h2>newConditionalFormatRule\u30e1\u30bd\u30c3\u30c9\uff08\u6761\u4ef6\u4ed8\u304d\u66f8\u5f0f\uff09<\/h2>\n<p>\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8\u306e\u6761\u4ef6\u4ed8\u304d\u66f8\u5f0f\u3092\u65b0\u305f\u306b\u4f5c\u6210\u3059\u308b\u305f\u3081\u306e\u30e1\u30bd\u30c3\u30c9\u3067\u3059\u3002<\/p>\n<p>\u3053\u306e\u30e1\u30bd\u30c3\u30c9\u306b\u7d9a\u3051\u3066\u8a2d\u5b9a\u6761\u4ef6\u3001\u8a2d\u5b9a\u3059\u308b\u5185\u5bb9\u3084\u8a2d\u5b9a\u3059\u308b\u7bc4\u56f2\u3092\u8a2d\u5b9a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8\u306e\u6a5f\u80fd\u4f5c\u6210\u30e1\u30bd\u30c3\u30c9\u306f<\/p>\n<p><strong><a href=\"https:\/\/for-dummies.net\/gas-noobs\/how-to-create-newconditionalformatrule-for-spreadsheets-by-gas\/\">newConditionalFormatRule\u30e1\u30bd\u30c3\u30c9<\/a>\uff08\u6761\u4ef6\u4ed8\u304d\u66f8\u5f0f\uff09\u3053\u306e\u30d6\u30ed\u30b0<\/strong><\/p>\n<p><strong><a href=\"https:\/\/for-dummies.net\/gas-noobs\/how-to-create-newdatavalidation-for-spreadsheets-by-gas\/\">newDataValidation()\u30e1\u30bd\u30c3\u30c9<\/a>\uff08\u5165\u529b\u898f\u5247\uff09<\/strong><\/p>\n<p id=\"newfiltercriteria\" class=\"showalways\" tabindex=\"0\" data-text=\" newFilterCriteria() \"><strong><a href=\"https:\/\/for-dummies.net\/gas-noobs\/how-to-create-newfiltercriteria-for-spreadsheets-by-gas\/\">newFilterCriteria()\u30e1\u30bd\u30c3\u30c9<\/a>\uff08\u30d5\u30a3\u30eb\u30bf\u4f5c\u6210\uff09<\/strong><\/p>\n<p><strong><a href=\"https:\/\/for-dummies.net\/gas-noobs\/how-to-create-newrichtextvalue-for-spreadsheets-by-gas\/\">newRichTextValue() \u30e1\u30bd\u30c3\u30c9<\/a>\uff08\u30ea\u30c3\u30c1\u30c6\u30ad\u30b9\u30c8\uff09<\/strong><\/p>\n<p><strong><a href=\"https:\/\/for-dummies.net\/gas-noobs\/how-to-create-newtextstyle-for-spreadsheets-by-gas\/\">newTextStyle()\u30e1\u30bd\u30c3\u30c9<\/a>\uff08\u30c6\u30ad\u30b9\u30c8\u30b9\u30bf\u30a4\u30eb\uff09<\/strong><\/p>\n<p>\u306a\u3069\u304c\u3042\u308a\u307e\u3059\u3002\uff08\u5404\u30ea\u30f3\u30af\u306b\u8a73\u3057\u3044\u8aac\u660e\u304c\u3042\u308b\u306e\u3067\u3054\u89a7\u304f\u3060\u3055\u3044\u3002\uff09<\/p>\n<p><strong>\u30af\u30e9\u30b9\uff1aSpreadsheetApp<\/strong><\/p>\n<p>\u6ce8\u610f\uff1a\u521d\u3081\u3066\u30b3\u30fc\u30c9\u3092\u5b9f\u884c\u3059\u308b\u969b\u306b\u30a2\u30af\u30bb\u30b9\u6a29\u9650\u306e\u8a31\u53ef\u3092\u6c42\u3081\u3089\u308c\u307e\u3059\u304c\u8a31\u53ef\u3092\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u30a2\u30af\u30bb\u30b9\u6a29\u9650\u306b\u3064\u3044\u3066\u306e\u8a73\u7d30\u306f\u4ee5\u4e0b\u306e\u8a18\u4e8b\u306b\u8a73\u3057\u304f\u8f09\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<p><a href=\"https:\/\/for-dummies.net\/gas-noobs\/how-to-set-gas-scopes-for-free-google-account\/\">\u7121\u6599\u306eGmail\u30a2\u30ab\u30a6\u30f3\u30c8\u3067GAS\u306b\u521d\u56de\u306e\u5b9f\u884c\u8a31\u53ef\u3092\u4e0e\u3048\u308b\u65b9\u6cd5<\/a><\/p>\n<h3>\u69cb\u9020<\/h3>\n<div id=\"codebox\">\n<pre class=\"\" dir=\"ltr\" translate=\"no\">  <strong>SpreadsheetApp.newConditionalFormatRule().\u30c8\u30ea\u30ac\u30fc.\u66f8\u5f0f.\u7bc4\u56f2.build()<\/strong><\/pre>\n<\/div>\n<p>\u3053\u3061\u3089\u304c\u6761\u4ef6\u4ed8\u304d\u66f8\u5f0f\u306e\u57fa\u672c\u30b9\u30af\u30ea\u30d7\u30c8\u3067\u3059\u3002<\/p>\n<p>newConditionalFormatRule()\u306e\u5f8c\u306b\u6761\u4ef6\u3068\u306a\u308b\u30c8\u30ea\u30ac\u30fc.\u66f8\u5f0f\u306e\u8a2d\u5b9a\u3001\u7bc4\u56f2\u30e1\u30bd\u30c3\u30c9\u3092\u30b9\u30af\u30ea\u30d7\u30c8\u3067\u8a18\u5165\u3092\u3057\u6700\u5f8c\u306bbuild()\u3067\u30d3\u30eb\u30c0\u30fc\u3092\u69cb\u7bc9\u3055\u305b\u307e\u3059\u3002<\/p>\n<p>\uff0anewConditionalFormatRule\u3067\u306f\u30c8\u30ea\u30ac\u30fc\u3092\u5165\u308c\u306a\u304b\u3063\u305f\u308a\u7bc4\u56f2\u3092\u5165\u308c\u306a\u304b\u3063\u305f\u308a\u3059\u308b\u3068\u30a8\u30e9\u30fc\u304c\u51fa\u308b\u306e\u3067\u5fd8\u308c\u305a\u306b\u8a2d\u5b9a\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8\u4e0a\u3067\u306f\u8868\u793a\u5f62\u5f0f\u2192\u6761\u4ef6\u4ed8\u304d\u66f8\u5f0f\u3092\u30af\u30ea\u30c3\u30af\u3059\u308b\u3068\u8868\u793a\u3055\u308c\u307e\u3059\u3002\u4e0b\u306e\u753b\u9762\u306e\u53f3\u5074\u306e\u8a2d\u5b9a\u3092\u4eca\u56de\u306e\u30e1\u30bd\u30c3\u30c9\u3067\u306f\u30b9\u30af\u30ea\u30d7\u30c8\u3067\u8a2d\u5b9a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p><img class=\"alignnone size-full wp-image-1711\" src=\"https:\/\/i2.wp.com\/for-dummies.net\/gas-noobs\/wp-content\/uploads\/2020\/09\/2020-09-07-22.12.08.png?resize=2732%2C1125&#038;ssl=1\" alt=\"2020-09-07 22.12.08\" width=\"2732\" height=\"1125\" srcset=\"https:\/\/i2.wp.com\/for-dummies.net\/gas-noobs\/wp-content\/uploads\/2020\/09\/2020-09-07-22.12.08.png?w=2732&amp;ssl=1 2732w, https:\/\/i2.wp.com\/for-dummies.net\/gas-noobs\/wp-content\/uploads\/2020\/09\/2020-09-07-22.12.08.png?resize=300%2C124&amp;ssl=1 300w, https:\/\/i2.wp.com\/for-dummies.net\/gas-noobs\/wp-content\/uploads\/2020\/09\/2020-09-07-22.12.08.png?resize=768%2C316&amp;ssl=1 768w, https:\/\/i2.wp.com\/for-dummies.net\/gas-noobs\/wp-content\/uploads\/2020\/09\/2020-09-07-22.12.08.png?resize=1024%2C422&amp;ssl=1 1024w, https:\/\/i2.wp.com\/for-dummies.net\/gas-noobs\/wp-content\/uploads\/2020\/09\/2020-09-07-22.12.08.png?resize=304%2C125&amp;ssl=1 304w, https:\/\/i2.wp.com\/for-dummies.net\/gas-noobs\/wp-content\/uploads\/2020\/09\/2020-09-07-22.12.08.png?resize=282%2C116&amp;ssl=1 282w, https:\/\/i2.wp.com\/for-dummies.net\/gas-noobs\/wp-content\/uploads\/2020\/09\/2020-09-07-22.12.08.png?w=2000&amp;ssl=1 2000w\" sizes=\"(max-width: 1000px) 100vw, 1000px\" data-recalc-dims=\"1\" \/><\/p>\n<p>\u66f8\u5f0f\u306f\u8907\u6570\u8a2d\u5b9a\u3059\u308b\u3053\u3068\u304c\u51fa\u6765\u3001\u7bc4\u56f2\u3082\u914d\u5217\u3068\u3057\u3066\u5165\u308c\u3089\u308c\u308b\u306e\u3067\u8907\u6570\u8a2d\u5b9a\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u305d\u3057\u3066\u6700\u5f8c\u306b.build()\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u3067\u30d3\u30eb\u30c0\u30fc\u3092\u69cb\u7bc9\u3059\u308b\u3053\u3068\u304c\u51fa\u6765\u307e\u3059\u3002<\/p>\n<p>\u30c8\u30ea\u30ac\u30fc\u3001\u66f8\u5f0f\u3001\u7bc4\u56f2\u306e\u30e1\u30bd\u30c3\u30c9\u306b\u3064\u3044\u3066\u306f\u5225\u8a18\u4e8b\uff08\u516c\u958b\u4e88\u5b9a\uff09\u3067\u8a73\u3057\u304f\u8aac\u660e\u3057\u3066\u3044\u307e\u3059\u306e\u3067\u305d\u3061\u3089\u3092\u3054\u89a7\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u4eca\u56de\u306f<a href=\"https:\/\/developers.google.com\/apps-script\/reference\/spreadsheet\/spreadsheet-app#newConditionalFormatRule()\" target=\"_blank\" rel=\"noopener\">Google\u30ea\u30d5\u30a1\u30ec\u30f3\u30b9<\/a>\u306e\u4f8b\u3092\u5143\u306b\u8aac\u660e\u3057\u307e\u3059\u3002\u4ee5\u4e0b\u304c\u30b9\u30af\u30ea\u30d7\u30c8\u3067\u3059\u3002<\/p>\n<h3>\u30b5\u30f3\u30d7\u30eb\u30b9\u30af\u30ea\u30d7\u30c8\uff11<\/h3>\n<div id=\"codebox\">\n<pre class=\"\" dir=\"ltr\" translate=\"no\">function newConditionalFormatRule\uff11(){\n  var sheet = SpreadsheetApp.getActive().getActiveSheet();\n  var range = sheet.getRange('A1:B3');\n  var rule = SpreadsheetApp.newConditionalFormatRule()\n  .whenNumberBetween(1, 10)\n  .setBackground(\"#FF0000\")\n  .setRanges([range])\n  .build();\n  var rules = sheet.getConditionalFormatRules();\n  console.log(rules);\n  rules.push(rule);\n  sheet.setConditionalFormatRules(rules);\n}<\/pre>\n<\/div>\n<p>\uff0a<a href=\"https:\/\/developers.google.com\/apps-script\/reference\/spreadsheet\/spreadsheet-app#newConditionalFormatRule()\" target=\"_blank\" rel=\"noopener\">Google\u30ea\u30d5\u30a1\u30ec\u30f3\u30b9<\/a>\u3067\u306f6\u884c\u76ee\u304c<strong><span class=\"pln\">setBackgroundColor<\/span><\/strong><span class=\"pun\">\u3068\u3042\u308a\u307e\u3059\u304c<strong>setBackground<\/strong>\u3092\u4f7f\u7528\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/span><\/p>\n<p><span class=\"pun\">\uff08\u30ea\u30d5\u30a1\u30ec\u30f3\u30b9\u306e\u307e\u307e\u3060\u3068\u30a8\u30e9\u30fc\u304c\u51fa\u3066\u3057\u307e\u3044\u307e\u3059\u3002\uff09<\/span><\/p>\n<p>\u5148\u307b\u3069\u306e\u69cb\u9020\u306e\u5834\u6240\u306f\uff14\u884c\u76ee\u304b\u3089\uff18\u884c\u76ee\u307e\u3067\u306e\u4ee5\u4e0b\u306e\u90e8\u5206\u3067\u3059\u3002<\/p>\n<div id=\"codebox\">\n<pre class=\"\" dir=\"ltr\" translate=\"no\">  \/\/\u30b5\u30f3\u30d7\u30eb\u30b9\u30af\u30ea\u30d7\u30c8\uff11\u3000\uff14\u884c\u76ee\u301c\uff18\u884c\u76ee\n  var rule = SpreadsheetApp.newConditionalFormatRule()\/\/\u6761\u4ef6\u4ed8\u304d\u66f8\u5f0f\u3092\u4f5c\u6210\u3059\u308b\u305f\u3081\u306e\u30e1\u30bd\u30c3\u30c9\n    .whenNumberBetween(1, 10) \/\/\u30c8\u30ea\u30ac\u30fc\uff1a\u6570\u5b57\u304c1~10\u306e\u9593\u306e\u6642\n    .setBackground(\"#FF0000\")\u3000\/\/\u66f8\u5f0f\uff1a\u30bb\u30eb\u306e\u80cc\u666f\u8272\u3092\u8a2d\u5b9a\uff08\u8d64\uff09\n    .setRanges([range])\u3000\/\/\u7bc4\u56f2\uff1a\u7bc4\u56f2\u3092\u8a2d\u5b9a (3\u884c\u76ee\u306eA1:B3\u304c\u7bc4\u56f2)\n    .build();\u3000\/\/\u30d3\u30eb\u30c0\u30fc\u3092\u69cb\u7bc9<\/pre>\n<\/div>\n<p>\u3053\u3061\u3089\u306e\u90e8\u5206\u304c\u6761\u4ef6\u4ed8\u304d\u66f8\u5f0f\u306e\u4f5c\u6210\u90e8\u5206\u306b\u306a\u308a\u307e\u3059\u3002\u7c21\u5358\u306a\u89e3\u8aac\u306f\u30b3\u30e1\u30f3\u30c8\u30a2\u30a6\u30c8\u306e\u90e8\u5206\u3092\u3054\u89a7\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u3061\u306a\u307f\u306b\u6539\u884c\u3057\u3066\u898b\u3084\u3059\u304f\u3057\u3066\u3044\u308b\u3060\u3051\u3067\u3059\u306e\u3067\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u66f8\u3044\u3066\u3082\u554f\u984c\u3042\u308a\u307e\u305b\u3093\u3002<\/p>\n<p>\uff08\u6a2a\u30b9\u30af\u30ed\u30fc\u30eb\u3067\u304d\u307e\u3059\uff09<\/p>\n<div id=\"codebox\">\n<pre class=\"\" dir=\"ltr\" translate=\"no\">  \/\/\u30b5\u30f3\u30d7\u30eb\u30b9\u30af\u30ea\u30d7\u30c81 4\u884c\u76ee\u301c8\u884c\u76ee\u3092\uff11\u884c\u306b\u307e\u3068\u3081\u305f\u3082\u306e\n  var rule = SpreadsheetApp.newConditionalFormatRule().whenNumberBetween(1, 10).setBackground(\"#FF0000\").setRanges([range]).build();<\/pre>\n<\/div>\n<p>\u3053\u308c\u3067\u65b0\u898f\u30d3\u30eb\u30c0\u30fc\u3092\u4f5c\u6210\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3057\u305f\u3002\u3053\u308c\u3060\u3051\u3067\u306f\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8\u306b\u8a2d\u5b9a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u305b\u3093\u3002\u307e\u305a\u306f\u6761\u4ef6\u4ed8\u304d\u66f8\u5f0f\u306e\u53d6\u5f97\u3092\u3057\u307e\u3059\u3002\uff19\u884c\u76ee\u306e<\/p>\n<div id=\"codebox\">\n<pre class=\"\" dir=\"ltr\" translate=\"no\">  \/\/\u30b5\u30f3\u30d7\u30eb\u30b9\u30af\u30ea\u30d7\u30c8\uff11\u30009\u884c\u76ee  \n  var rules = sheet.getConditionalFormatRules()<\/pre>\n<\/div>\n<p>\u306e\u90e8\u5206\u3067\u3053\u306e\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8\u306e\u6761\u4ef6\u4ed8\u304d\u66f8\u5f0f\u3092\u53d6\u5f97\u3057\u307e\u3059\u3002\u3053\u306e\u90e8\u5206\u306f\u914d\u5217\u3067\u53d6\u5f97\u3067\u304d\u307e\u3059\u304c\u4eca\u56de\u306f\u6700\u521d\u306f\u4f55\u3082\u8a2d\u5b9a\u3057\u3066\u3044\u307e\u305b\u3093\u306e\u3067\u914d\u5217\u306e\u4e2d\u306f\u7a7a\u3067\u3059\u3002\u30ed\u30b0\u3092\u78ba\u8a8d\u3057\u3066\u307f\u308b\u3068<\/p>\n<p><img class=\"alignnone size-full wp-image-1705\" src=\"https:\/\/i2.wp.com\/for-dummies.net\/gas-noobs\/wp-content\/uploads\/2020\/09\/2020-09-06-18.04.21.png?resize=1360%2C301&#038;ssl=1\" alt=\"2020-09-06 18.04.21\" width=\"1360\" height=\"301\" srcset=\"https:\/\/i2.wp.com\/for-dummies.net\/gas-noobs\/wp-content\/uploads\/2020\/09\/2020-09-06-18.04.21.png?w=1360&amp;ssl=1 1360w, https:\/\/i2.wp.com\/for-dummies.net\/gas-noobs\/wp-content\/uploads\/2020\/09\/2020-09-06-18.04.21.png?resize=300%2C66&amp;ssl=1 300w, https:\/\/i2.wp.com\/for-dummies.net\/gas-noobs\/wp-content\/uploads\/2020\/09\/2020-09-06-18.04.21.png?resize=768%2C170&amp;ssl=1 768w, https:\/\/i2.wp.com\/for-dummies.net\/gas-noobs\/wp-content\/uploads\/2020\/09\/2020-09-06-18.04.21.png?resize=1024%2C227&amp;ssl=1 1024w, https:\/\/i2.wp.com\/for-dummies.net\/gas-noobs\/wp-content\/uploads\/2020\/09\/2020-09-06-18.04.21.png?resize=304%2C67&amp;ssl=1 304w, https:\/\/i2.wp.com\/for-dummies.net\/gas-noobs\/wp-content\/uploads\/2020\/09\/2020-09-06-18.04.21.png?resize=282%2C62&amp;ssl=1 282w\" sizes=\"(max-width: 1000px) 100vw, 1000px\" data-recalc-dims=\"1\" \/><\/p>\n<p>\u3053\u306e\u3088\u3046\u306b\u914d\u5217\u306e\u4e2d\u306f\u7a7a\u3063\u307d\u3067\u3059\u3002\u3067\u3059\u306e\u3067\u5148\u307b\u3069\u4f5c\u6210\u3057\u305frule\u3092\u914d\u5217\u306b\u8ffd\u52a0\u3057\u307e\u3059\u3002\u305d\u308c\u304c<\/p>\n<div id=\"codebox\">\n<pre class=\"\" dir=\"ltr\" translate=\"no\">  \/\/\u30b5\u30f3\u30d7\u30eb\u30b9\u30af\u30ea\u30d7\u30c8\uff11\u300011\u884c\u76ee\n  rules.push(rule);<\/pre>\n<\/div>\n<p>\u306e\u90e8\u5206\u3067\u3059\u3002\u305d\u3057\u3066rule\u3092\u8ffd\u52a0\u3057\u305frules\u3092<\/p>\n<div id=\"codebox\">\n<pre class=\"\" dir=\"ltr\" translate=\"no\">  \/\/\u30b5\u30f3\u30d7\u30eb\u30b9\u30af\u30ea\u30d7\u30c8\uff11\u300012\u884c\u76ee  \n  sheet.setConditionalFormatRules(rules);<\/pre>\n<\/div>\n<p>\u3067\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8\u306b\u8a2d\u5b9a\u3092\u3057\u307e\u3059\u3002\u4eca\u56de\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u8d77\u52d5\u3059\u308b\u3053\u3068\u306b\u4ee5\u4e0b\u306e\u753b\u50cf\u306e\u3088\u3046\u306bA1:B3\u306e\u7bc4\u56f2\u306b\uff11\u301c\uff11\uff10\u306e\u6570\u5b57\u3092\u5165\u308c\u308b\u3068\u30bb\u30eb\u80cc\u666f\u304c\u8d64\u304f\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>A4\u306f\u5bfe\u8c61\u5916\u306e\u305f\u3081\uff11\u3068\u5165\u529b\u3057\u3066\u3082\u5909\u5316\u306f\u3042\u308a\u307e\u305b\u3093\u3002\u8868\u793a\u5f62\u5f0f\u30bf\u30d6\u306e\u6761\u4ef6\u4ed8\u304d\u66f8\u5f0f\u3092\u30af\u30ea\u30c3\u30af\u3059\u308b\u3068\u53f3\u306e\u3088\u3046\u306b\u6761\u4ef6\u4ed8\u304d\u66f8\u5f0f\u304c\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u308b\u306e\u304c\u308f\u304b\u308a\u307e\u3059\u306d\u3002<\/p>\n<p><img class=\"alignnone size-full wp-image-1690\" src=\"https:\/\/i1.wp.com\/for-dummies.net\/gas-noobs\/wp-content\/uploads\/2020\/09\/2020-09-03-22.29.58.png?resize=2727%2C904&#038;ssl=1\" alt=\"2020-09-03 22.29.58\" width=\"2727\" height=\"904\" srcset=\"https:\/\/i1.wp.com\/for-dummies.net\/gas-noobs\/wp-content\/uploads\/2020\/09\/2020-09-03-22.29.58.png?w=2727&amp;ssl=1 2727w, https:\/\/i1.wp.com\/for-dummies.net\/gas-noobs\/wp-content\/uploads\/2020\/09\/2020-09-03-22.29.58.png?resize=300%2C99&amp;ssl=1 300w, https:\/\/i1.wp.com\/for-dummies.net\/gas-noobs\/wp-content\/uploads\/2020\/09\/2020-09-03-22.29.58.png?resize=768%2C255&amp;ssl=1 768w, https:\/\/i1.wp.com\/for-dummies.net\/gas-noobs\/wp-content\/uploads\/2020\/09\/2020-09-03-22.29.58.png?resize=1024%2C339&amp;ssl=1 1024w, https:\/\/i1.wp.com\/for-dummies.net\/gas-noobs\/wp-content\/uploads\/2020\/09\/2020-09-03-22.29.58.png?resize=304%2C101&amp;ssl=1 304w, https:\/\/i1.wp.com\/for-dummies.net\/gas-noobs\/wp-content\/uploads\/2020\/09\/2020-09-03-22.29.58.png?resize=282%2C93&amp;ssl=1 282w, https:\/\/i1.wp.com\/for-dummies.net\/gas-noobs\/wp-content\/uploads\/2020\/09\/2020-09-03-22.29.58.png?w=2000&amp;ssl=1 2000w\" sizes=\"(max-width: 1000px) 100vw, 1000px\" data-recalc-dims=\"1\" \/><\/p>\n<h3>\u30b5\u30f3\u30d7\u30eb\u30b9\u30af\u30ea\u30d7\u30c8\uff12<\/h3>\n<p>\u3082\u3046\u4e00\u3064\u30b5\u30f3\u30d7\u30eb\u3092\u4f5c\u6210\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<div id=\"codebox\">\n<pre class=\"\" dir=\"ltr\" translate=\"no\">function newConditionalFormatRule2(){\n  var sheet = SpreadsheetApp.getActive().getActiveSheet();\n  var range = sheet.getRange('C1:E3');\u3000<strong>\/\/C1:E3\u306e\u7bc4\u56f2<\/strong>\n  var rule = SpreadsheetApp.newConditionalFormatRule()\n    .whenCellNotEmpty()\u3000<strong>\/\/\u7a7a\u767d\u3067\u306f\u306a\u3044\u30bb\u30eb\u306e\u6642<\/strong>\n    .setBackground(\"#0000ff\")\u3000<strong>\/\/\u30bb\u30eb\u80cc\u666f\u3092\u8a2d\u5b9a\uff08\u9752\uff09<\/strong>\n    .setRanges([range])\n    .build();\n  var rules = sheet.getConditionalFormatRules();\n  console.log(rules);\n  rules.push(rule);\n  sheet.setConditionalFormatRules(rules);\n}<\/pre>\n<\/div>\n<p>\u30b3\u30e1\u30f3\u30c8\u30a2\u30a6\u30c8\u3057\u3066\u3042\u308b\u90e8\u5206\u3092\u5909\u66f4\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u4eca\u56de\u306e\u6761\u4ef6\u306fwhenCellNotEmpty\u3068\u3044\u3046\u7a7a\u767d\u3067\u306f\u306a\u3044\u30bb\u30eb\u306e\u6642\u3068\u3044\u3046\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u7528\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u8a18\u5165\u65b9\u6cd5\u3068\u3057\u3066\u306f\u30b5\u30f3\u30d7\u30eb\u30b9\u30af\u30ea\u30d7\u30c8\uff11\u306b\u7d9a\u3044\u3066\u8a18\u5165\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u5b9f\u884c\u3057\u3066\u30ed\u30b0\u3092\u78ba\u8a8d\u3057\u3066\u307f\u308b\u3068\uff11\u3067\u4f5c\u6210\u3057\u305f\u6761\u4ef6\u4ed8\u304d\u66f8\u5f0f\u306e\u30c7\u30fc\u30bf\u304c\u5165\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u4f55\u304c\u66f8\u3044\u3066\u3042\u308b\u306e\u304b\u30c7\u30fc\u30bf\u306e\u4e2d\u8eab\u306f\u5206\u304b\u308a\u307e\u305b\u3093\u304c\u4f55\u304b\u306e\u30c7\u30fc\u30bf\u304c\u683c\u7d0d\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u304c\u5206\u304b\u308a\u307e\u3059\u306d\u3002<\/p>\n<p><img class=\"alignnone size-full wp-image-1704\" src=\"https:\/\/i0.wp.com\/for-dummies.net\/gas-noobs\/wp-content\/uploads\/2020\/09\/2020-09-06-17.05.12.png?resize=1892%2C329&#038;ssl=1\" alt=\"2020-09-06 17.05.12\" width=\"1892\" height=\"329\" srcset=\"https:\/\/i0.wp.com\/for-dummies.net\/gas-noobs\/wp-content\/uploads\/2020\/09\/2020-09-06-17.05.12.png?w=1892&amp;ssl=1 1892w, https:\/\/i0.wp.com\/for-dummies.net\/gas-noobs\/wp-content\/uploads\/2020\/09\/2020-09-06-17.05.12.png?resize=300%2C52&amp;ssl=1 300w, https:\/\/i0.wp.com\/for-dummies.net\/gas-noobs\/wp-content\/uploads\/2020\/09\/2020-09-06-17.05.12.png?resize=768%2C134&amp;ssl=1 768w, https:\/\/i0.wp.com\/for-dummies.net\/gas-noobs\/wp-content\/uploads\/2020\/09\/2020-09-06-17.05.12.png?resize=1024%2C178&amp;ssl=1 1024w, https:\/\/i0.wp.com\/for-dummies.net\/gas-noobs\/wp-content\/uploads\/2020\/09\/2020-09-06-17.05.12.png?resize=304%2C53&amp;ssl=1 304w, https:\/\/i0.wp.com\/for-dummies.net\/gas-noobs\/wp-content\/uploads\/2020\/09\/2020-09-06-17.05.12.png?resize=282%2C49&amp;ssl=1 282w\" sizes=\"(max-width: 1000px) 100vw, 1000px\" data-recalc-dims=\"1\" \/><\/p>\n<p>\u305d\u3057\u3066\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8\u3092\u78ba\u8a8d\u3057\u3066\u307f\u307e\u3059\u3002\u4eca\u56de\u306fC1:D3\u307e\u3067\u6570\u5024\u3092\u5165\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<p><img class=\"alignnone size-full wp-image-1706\" src=\"https:\/\/i2.wp.com\/for-dummies.net\/gas-noobs\/wp-content\/uploads\/2020\/09\/2020-09-06-18.00.47.png?resize=2745%2C654&#038;ssl=1\" alt=\"2020-09-06 18.00.47\" width=\"2745\" height=\"654\" srcset=\"https:\/\/i2.wp.com\/for-dummies.net\/gas-noobs\/wp-content\/uploads\/2020\/09\/2020-09-06-18.00.47.png?w=2745&amp;ssl=1 2745w, https:\/\/i2.wp.com\/for-dummies.net\/gas-noobs\/wp-content\/uploads\/2020\/09\/2020-09-06-18.00.47.png?resize=300%2C71&amp;ssl=1 300w, https:\/\/i2.wp.com\/for-dummies.net\/gas-noobs\/wp-content\/uploads\/2020\/09\/2020-09-06-18.00.47.png?resize=768%2C183&amp;ssl=1 768w, https:\/\/i2.wp.com\/for-dummies.net\/gas-noobs\/wp-content\/uploads\/2020\/09\/2020-09-06-18.00.47.png?resize=1024%2C244&amp;ssl=1 1024w, https:\/\/i2.wp.com\/for-dummies.net\/gas-noobs\/wp-content\/uploads\/2020\/09\/2020-09-06-18.00.47.png?resize=304%2C72&amp;ssl=1 304w, https:\/\/i2.wp.com\/for-dummies.net\/gas-noobs\/wp-content\/uploads\/2020\/09\/2020-09-06-18.00.47.png?resize=282%2C67&amp;ssl=1 282w, https:\/\/i2.wp.com\/for-dummies.net\/gas-noobs\/wp-content\/uploads\/2020\/09\/2020-09-06-18.00.47.png?w=2000&amp;ssl=1 2000w\" sizes=\"(max-width: 1000px) 100vw, 1000px\" data-recalc-dims=\"1\" \/><\/p>\n<p>\u3053\u306e\u3088\u3046\u306b\u30b9\u30af\u30ea\u30d7\u30c8\uff11\u30fb\uff12\u3067\u4f5c\u6210\u3057\u305f\u6761\u4ef6\u4ed8\u304d\u66f8\u5f0f\u304c\u53cd\u6620\u3055\u308c\u3066\u308b\u3053\u3068\u304c\u5206\u304b\u308a\u307e\u3059\u3002<\/p>\n<p>\u3053\u306e\u3088\u3046\u306b\u8907\u6570\u306e\u66f8\u5f0f\u3092\u8ffd\u52a0\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u306e\u3067\u69d8\u3005\u306a\u6761\u4ef6\u3092\u4e00\u3064\u306e\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8\u306b\u8a2d\u5b9a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u306d\u3002<\/p>\n<p>\u3053\u306e\u4ed6\u306e\u6761\u4ef6\u4ed8\u304d\u66f8\u5f0f\u306e\u30c8\u30ea\u30ac\u30fc\u3084\u8a2d\u5b9a\u30e1\u30bd\u30c3\u30c9\u306f<\/p>\n<p class=\"devsite-page-title\"><strong>Class ConditionalFormatRuleBuilder\uff08\u516c\u958b\u4e88\u5b9a\uff09<\/strong>\u3067\u8a73\u3057\u304f\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n<div id=\"codebox\">\n<h2>\u307e\u3068\u3081<\/h2>\n<p>\u4eca\u56de\u306f\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8\u306e\u6761\u4ef6\u4ed8\u304d\u66f8\u5f0f\u3092\u4f5c\u6210\u3059\u308b\u305f\u3081\u306e\u30d3\u30eb\u30c0\u30fc\u3067\u3042\u308bnewConditionalFormatRule\u30e1\u30bd\u30c3\u30c9\u3092\u7d39\u4ecb\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u3053\u306e\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u306b\u3088\u3063\u3066\u4eca\u56de\u306e\u30b5\u30f3\u30d7\u30eb\u306e\u3088\u3046\u306b<\/p>\n<p>\u6b63\u3057\u3044\u6570\u5024\u3092\u5165\u308c\u308b\u8272\u304c\u3064\u3044\u305f\u308a\u3001<\/p>\n<p>\u9593\u9055\u3063\u305f\u6570\u5024\u3092\u5165\u308c\u308b\u3068\u8272\u304c\u3064\u304f<\/p>\n<p>\u3068\u3044\u3063\u305f\u3088\u3046\u306a\u6761\u4ef6\u3092\u3042\u3089\u304b\u3058\u3081\u30b9\u30af\u30ea\u30d7\u30c8\u3067\u8a2d\u5b9a\u3092\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u3053\u308c\u306b\u3088\u3063\u3066\u3044\u3061\u3044\u3061\u624b\u52d5\u3067\u8a2d\u5b9a\u3059\u308b\u3053\u3068\u3092\u305b\u305a\u3001\u4f5c\u696d\u306e\u52b9\u7387\u5316\u3084\u30df\u30b9\u306e\u4f4e\u4e0b\u3082\u9632\u3050\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u307e\u305f\u78ba\u8a8d\u8005\u3082\u3069\u3053\u304c\u9593\u9055\u3063\u3066\u3044\u308b\u304b\u7c21\u5358\u306b\u78ba\u8a8d\u51fa\u6765\u308b\u306e\u3067\u30c1\u30a7\u30c3\u30af\u3059\u308b\u6642\u9593\u3082\u5927\u5e45\u306b\u77ed\u7e2e\u3059\u308b\u3053\u3068\u304c\u53ef\u80fd\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u3053\u306e\u30e1\u30bd\u30c3\u30c9\u306e\u4f7f\u3044\u65b9\u3092\u3057\u3063\u304b\u308a\u899a\u3048\u3066\u6d3b\u7528\u3067\u304d\u308b\u3068\u3044\u3044\u3067\u3059\u306d\u3002<\/p>\n<p>\u3053\u3053\u307e\u3067\u3054\u89a7\u3044\u305f\u3060\u304d\u3042\u308a\u304c\u3068\u3046\u3054\u3056\u3044\u307e\u3057\u305f\u3002<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8\u3092\u4f5c\u6210\u3059\u308b\u969b\u306b\u7279\u5b9a\u306e\u6761\u4ef6\uff08\u7a7a\u767d\u3060\u3063\u305f\u3089\u8272\u3092\u3064\u3051\u308b\u3001\u3053\u306e\u6587\u5b57\u306e\u6642\u306f\u592a\u5b57\u306b\u3059\u308b\u306a\u3069\uff09\u3092\u8a2d\u5b9a\u3055\u305b\u305f\u3044\u6642\u304c\u3042\u308a\u307e\u3059\u3002\u8868\u793a\u5f62\u5f0f\u304b\u3089\u6761\u4ef6\u4ed8\u304d\u66f8\u5f0f\u3092\u30af\u30ea\u30c3\u30af\u3057\u3066\u6bce\u56de\u8a2d\u5b9a\u3059\u308b\u65b9\u6cd5\u3067\u3082\u3044\u3044\u306e\u3067\u3059\u304c\u6bce\u56de\u4f5c\u6210\u3059\u308b\u3088\u3046\u306a\u5831\u544a\u66f8\b [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":1628,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"swell_btn_cv_data":"","spay_email":"","jetpack_publicize_message":"\u3010GAS\u3011\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8\u306e\u6761\u4ef6\u4ed8\u304d\u66f8\u5f0f\u3092\u4f5c\u6210\u3059\u308bnewConditionalFormatRule\u30e1\u30bd\u30c3\u30c9\u3092\u30de\u30b9\u30bf\u30fc\r\n#newConditionalFormatRule #\u6761\u4ef6\u4ed8\u304d\u66f8\u5f0f #spreadsheet","jetpack_is_tweetstorm":false},"categories":[16,15,3],"tags":[53,51,52,152,154,113,153],"jetpack_featured_media_url":"https:\/\/i1.wp.com\/for-dummies.net\/gas-noobs\/wp-content\/uploads\/2020\/08\/sheetsReference.png?fit=320%2C180&ssl=1","jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p9Z92k-rt","jetpack_likes_enabled":true,"amp_validity":null,"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/for-dummies.net\/gas-noobs\/wp-json\/wp\/v2\/posts\/1703"}],"collection":[{"href":"https:\/\/for-dummies.net\/gas-noobs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/for-dummies.net\/gas-noobs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/for-dummies.net\/gas-noobs\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/for-dummies.net\/gas-noobs\/wp-json\/wp\/v2\/comments?post=1703"}],"version-history":[{"count":11,"href":"https:\/\/for-dummies.net\/gas-noobs\/wp-json\/wp\/v2\/posts\/1703\/revisions"}],"predecessor-version":[{"id":2700,"href":"https:\/\/for-dummies.net\/gas-noobs\/wp-json\/wp\/v2\/posts\/1703\/revisions\/2700"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/for-dummies.net\/gas-noobs\/wp-json\/wp\/v2\/media\/1628"}],"wp:attachment":[{"href":"https:\/\/for-dummies.net\/gas-noobs\/wp-json\/wp\/v2\/media?parent=1703"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/for-dummies.net\/gas-noobs\/wp-json\/wp\/v2\/categories?post=1703"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/for-dummies.net\/gas-noobs\/wp-json\/wp\/v2\/tags?post=1703"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}