{"id":3894,"date":"2021-07-23T22:16:10","date_gmt":"2021-07-23T13:16:10","guid":{"rendered":"https:\/\/auto-worker.com\/blog\/?p=3894"},"modified":"2021-07-23T22:16:10","modified_gmt":"2021-07-23T13:16:10","slug":"post-3894","status":"publish","type":"post","link":"https:\/\/auto-worker.com\/blog\/?p=3894","title":{"rendered":"GAS\u306e\u914d\u5217\u306e\u8981\u7d20\u6570(\u9577\u3055)\u3092\u53d6\u5f97\u3059\u308b\u65b9\u6cd5(length\u30d7\u30ed\u30d1\u30c6\u30a3)"},"content":{"rendered":"<p>Google Apps Script(GAS)\u3067\u914d\u5217\u3092\u6271\u3063\u3066\u3044\u308b\u3068\u3001\u305d\u306e\u914d\u5217\u306e\u8981\u7d20\u6570\u30fb\u9577\u3055\u3092\u77e5\u308a\u305f\u3044\u5834\u5408\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u305d\u3053\u3067\u914d\u5217\u306e\u8981\u7d20\u6570\u304c\u3044\u304f\u3064\u3042\u308b\u304b\u3001\u914d\u5217\u306e\u9577\u3055\u3092\u78ba\u8a8d\u3059\u308b\u65b9\u6cd5\u3092\u89e3\u8aac\u3057\u307e\u3059\u3002<\/p>\n<h2>GAS\u3067\u914d\u5217\u306e\u8981\u7d20\u6570\u3092\u78ba\u8a8d\u3057\u305f\u3044<\/h2>\n<p>Google Apps Script(GAS)\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u3067\u306f\u3001\u914d\u5217\u3092\u4f7f\u3063\u3066\u51e6\u7406\u3092\u884c\u3046\u3053\u3068\u304c\u591a\u3044\u3067\u3059\u3002<\/p>\n<p>\u914d\u5217\u306f\u30c7\u30fc\u30bf\u30921\u6b21\u5143\uff5en\u6b21\u5143\u306b\u683c\u7d0d\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u30c7\u30fc\u30bf\u5f62\u5f0f\u3067\u30012\u6b21\u5143\u914d\u5217\u306e\u5834\u5408\u3001\u8868\u5f62\u5f0f\u306e\u3088\u3046\u306b\u30c7\u30fc\u30bf\u3092\u7ba1\u7406\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u305d\u306e\u969b\u306b\u914d\u5217\u306e\u8981\u7d20\u6570\u304c\u3044\u304f\u3064\u3042\u308b\u304b\u78ba\u8a8d\u3059\u308b\u5fc5\u8981\u304c\u51fa\u3066\u304d\u307e\u3059\u3002<\/p>\n<p>\u914d\u5217\u306e\u8981\u7d20\u3059\u3079\u3066\u306b\u51e6\u7406\u3092\u884c\u3063\u305f\u308a\u96c6\u8a08\u3092\u884c\u3046\u305f\u3081\u306b\u3001\u914d\u5217\u306e\u8981\u7d20\u6570\u3059\u306a\u308f\u3061\u9577\u3055\u3092\u53d6\u5f97\u3057\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093\u3002<\/p>\n<h2>length\u30d7\u30ed\u30d1\u30c6\u30a3\u3067\u8981\u7d20\u6570\u3092\u53d6\u5f97<\/h2>\n<p>Google Apps Script(GAS)\u3067\u306e\u914d\u5217\u306e\u8981\u7d20\u6570\u3092\u53d6\u5f97\u3059\u308b\u306b\u306f\u3001Javascript\u306a\u3069\u4ed6\u306e\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u8a00\u8a9e\u3068\u540c\u69d8\u306b\u3001length\u30d7\u30ed\u30d1\u30c6\u30a3\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002<\/p>\n<p><em><strong>Array.length;<\/strong><\/em><\/p>\n<p>\u8981\u7d20\u6570\u3092\u53d6\u5f97\u3057\u305f\u3044\u914d\u5217\u306b\u5bfe\u3057\u300c.length\u300d\u3092\u4ed8\u3051\u308b\u3068\u3001\u305d\u306e\u914d\u5217\u306e\u8981\u7d20\u6570\u3092\u8fd4\u3057\u3066\u304f\u308c\u307e\u3059\u3002<\/p>\n<p>\u306a\u304a\u3001length\u306f\u30e1\u30bd\u30c3\u30c9\u3067\u306f\u306a\u304f\u30d7\u30ed\u30d1\u30c6\u30a3\u306e\u305f\u3081\u3001\u5f15\u6570\u3082\u4e0d\u8981\u3067\u62ec\u5f27()\u3082\u4ed8\u3051\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u305b\u3093\u3002<\/p>\n<h2>\u914d\u5217\u306e\u8981\u7d20\u6570\u3092\u53d6\u5f97\u3059\u308bGAS\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9<\/h2>\n<p>\u5b9f\u969b\u306bGoogle Apps Script(GAS)\u3067\u914d\u5217\u306e\u8981\u7d20\u6570\u3092\u53d6\u5f97\u3059\u308b\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n<p>\u679c\u7269\u306e\u540d\u524d\u3092\u683c\u7d0d\u3057\u305f1\u6b21\u5143\u914d\u5217fruits\u306b\u5bfe\u3057\u3001length\u30d7\u30ed\u30d1\u30c6\u30a3\u3067\u8981\u7d20\u6570\u3092\u53d6\u5f97\u3057\u3066\u3001\u5b9f\u884c\u30ed\u30b0\u306b\u51fa\u529b\u3059\u308b\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u3067\u3059\u3002<\/p>\n<p><code>function myFunction() {<br \/>\n\/\/1\u6b21\u5143\u914d\u5217\u3092\u5b9a\u7fa9<br \/>\nlet fruits = [\"\u308a\u3093\u3054\", \"\u307f\u304b\u3093\", \"\u3044\u3061\u3054\"];<br \/>\n\/\/\u914d\u5217\u306e\u8981\u7d20\u3092\u5b9f\u884c\u30ed\u30b0\u3067\u78ba\u8a8d<br \/>\nconsole.log(fruits);<br \/>\n\/\/length\u30d7\u30ed\u30d1\u30c6\u30a3\u3067\u914d\u5217\u306e\u8981\u7d20\u6570\u3092\u53d6\u5f97\u3059\u308b<br \/>\nlet fruitsNum = fruits.length;<br \/>\n\/\/\u914d\u5217\u306e\u8981\u7d20\u6570\u3067\u5b9f\u884c\u30ed\u30b0\u3067\u78ba\u8a8d<br \/>\nconsole.log(fruitsNum);<br \/>\n}<\/code><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3898\" src=\"https:\/\/auto-worker.com\/blog\/wp-content\/uploads\/2021\/07\/20210723_auto_001.jpg\" alt=\"Google Apps Script(GAS)\u3067\u914d\u5217\u306e\u8981\u7d20\u6570(\u9577\u3055)\u3092length\u30d7\u30ed\u30d1\u30c6\u30a3\u3067\u53d6\u5f97\u3059\u308b\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\" width=\"1200\" height=\"612\" srcset=\"https:\/\/auto-worker.com\/blog\/wp-content\/uploads\/2021\/07\/20210723_auto_001.jpg 1200w, https:\/\/auto-worker.com\/blog\/wp-content\/uploads\/2021\/07\/20210723_auto_001-300x153.jpg 300w, https:\/\/auto-worker.com\/blog\/wp-content\/uploads\/2021\/07\/20210723_auto_001-768x392.jpg 768w, https:\/\/auto-worker.com\/blog\/wp-content\/uploads\/2021\/07\/20210723_auto_001-1024x522.jpg 1024w, https:\/\/auto-worker.com\/blog\/wp-content\/uploads\/2021\/07\/20210723_auto_001-530x270.jpg 530w, https:\/\/auto-worker.com\/blog\/wp-content\/uploads\/2021\/07\/20210723_auto_001-565x288.jpg 565w, https:\/\/auto-worker.com\/blog\/wp-content\/uploads\/2021\/07\/20210723_auto_001-710x362.jpg 710w, https:\/\/auto-worker.com\/blog\/wp-content\/uploads\/2021\/07\/20210723_auto_001-725x370.jpg 725w\" sizes=\"auto, (max-width: 1200px) 100vw, 1200px\" \/><\/p>\n<p>\u914d\u5217\u306e\u8981\u7d20\u6570\u304clength\u30d7\u30ed\u30d1\u30c6\u30a3\u3067\u53d6\u5f97\u3067\u304d\u3066\u3044\u308b\u3053\u3068\u304c\u5b9f\u884c\u30ed\u30b0\u3067\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u3053\u306e\u3088\u3046\u306bGAS\u30b9\u30af\u30ea\u30d7\u30c8\u3067\u306f\u914d\u5217\u306b\u5bfe\u3057\u3001length\u30d7\u30ed\u30d1\u30c6\u30a3\u3067\u8981\u7d20\u6570(\u914d\u5217\u306e\u30b5\u30a4\u30ba)\u304c\u53d6\u5f97\u53ef\u80fd\u3067\u3059\u3002<\/p>\n<h2>for\u30eb\u30fc\u30d7\u306e\u51e6\u7406\u3067length\u3092\u6d3b\u7528<\/h2>\n<p>GAS\u306e\u914d\u5217\u306e\u8981\u7d20\u6570\u30fb\u9577\u3055\u3092\u53d6\u5f97\u3067\u304d\u308blength\u30d7\u30ed\u30d1\u30c6\u30a3\u306e\u5229\u7528\u30b7\u30fc\u30f3\u3068\u3057\u3066\u306f\u3001for\u30eb\u30fc\u30d7\u306b\u3088\u308b\u7e70\u308a\u8fd4\u3057\u51e6\u7406\u304c\u6319\u3052\u3089\u308c\u307e\u3059\u3002<\/p>\n<p>for\u30eb\u30fc\u30d7\u306f\u3042\u3089\u304b\u3058\u3081\u8a2d\u5b9a\u3057\u305f\u56de\u6570\u306e\u51e6\u7406\u3092\u7e70\u308a\u8fd4\u3057\u307e\u3059\u304c\u3001\u914d\u5217\u306e\u8981\u7d20\u306e\u6570\u3060\u3051\u51e6\u7406\u3092\u884c\u3046\u305f\u3081\u3001length\u30d7\u30ed\u30d1\u30c6\u30a3\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<p><span style=\"background-color: #d4d2d2;\"><em>for(let i=0; i&lt;array.length; i++){<\/em><\/span><\/p>\n<p><span style=\"background-color: #d4d2d2;\"><em>\u00a0 \/\/\u914d\u5217array\u306e\u8981\u7d20\u306e\u6570\u3060\u3051\u51e6\u7406\u3092\u884c\u3046<\/em><\/span><\/p>\n<p><span style=\"background-color: #d4d2d2;\"><em>}<\/em><\/span><\/p>\n<p>for\u30eb\u30fc\u30d7\u306e\u5224\u5b9a\u6761\u4ef6\u306b\u300c\u914d\u5217\u306e\u8981\u7d20\u6570\u3088\u308a\u3082\u5c0f\u3055\u3044\u5834\u5408\u306b\u51e6\u7406\u3092\u884c\u3046\u300d\u3068\u3057\u3066\u3001\u914d\u5217\u306e\u5168\u8981\u7d20\u306b\u51e6\u7406\u3092\u884c\u3046GAS\u30b3\u30fc\u30c9\u3092\u8a18\u8ff0\u3057\u307e\u3059\u3002<\/p>\n<h2>\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8\u306e\u7bc4\u56f2\u6307\u5b9a\u306b\u3082\u4fbf\u5229<\/h2>\n<p>\u914d\u5217\u306elength\u30d7\u30ed\u30d1\u30c6\u30a3\u306e\u6d3b\u7528\u4e8b\u4f8b\u3068\u3057\u3066\u3001\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8\u3068\u306e\u9023\u643a\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>Google Apps Script(GAS)\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u3067\u51e6\u7406\u3057\u305f2\u6b21\u5143\u914d\u5217\u306e\u30c7\u30fc\u30bf\u306f\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8\u306bsetValues\u30e1\u30bd\u30c3\u30c9\u3067\u66f8\u304d\u8fbc\u3080\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<blockquote class=\"wp-embedded-content\" data-secret=\"qpuYQLVxsl\"><p><a href=\"https:\/\/auto-worker.com\/blog\/?p=655\">Google Apps Script(GAS)\u5165\u9580 \u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8\u306e\u30bb\u30eb\u53d6\u5f97\u30fb\u66f8\u304d\u8fbc\u307f\u65b9\u6cd5(getValue,setValue)<\/a><\/p><\/blockquote>\n<p><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"&#8220;Google Apps Script(GAS)\u5165\u9580 \u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8\u306e\u30bb\u30eb\u53d6\u5f97\u30fb\u66f8\u304d\u8fbc\u307f\u65b9\u6cd5(getValue,setValue)&#8221; &#8212; AutoWorker\u301cGoogle Apps Script(GAS)\u3068Sikuli\u3067\u59cb\u3081\u308b\u696d\u52d9\u6539\u5584\u5165\u9580\" src=\"https:\/\/auto-worker.com\/blog\/?p=655&#038;embed=true#?secret=0XjTDnixnv#?secret=qpuYQLVxsl\" data-secret=\"qpuYQLVxsl\" width=\"500\" height=\"282\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe><\/p>\n<p>\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8\u306b\u30c7\u30fc\u30bf\u3092\u51fa\u529b\u3059\u308b\u30bb\u30eb\u7bc4\u56f2\u3092getRange\u30e1\u30bd\u30c3\u30c9\u3067\u6307\u5b9a\u3059\u308b\u969b\u306b2\u6b21\u5143\u914d\u5217\u306elength\u30d7\u30ed\u30d1\u30c6\u30a3\u304c\u4fbf\u5229\u3067\u3059\u3002<\/p>\n<p><em><strong>Spreadsheet.getRange(1, 1, array.length, array[0].length).setValues(array);<\/strong><\/em><\/p>\n<p>\u7b2c3\u5f15\u6570\u3068\u7b2c4\u5f15\u6570\u306blength\u30d7\u30ed\u30d1\u30c6\u30a3\u306e\u6570\u5024\u3092\u6307\u5b9a\u3059\u308b\u3053\u3068\u3067\u3001\u914d\u5217\u306e\u5927\u304d\u3055\u304c\u5909\u5316\u3057\u3066\u3082setValues\u304c\u5b9f\u884c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u51e6\u7406\u3059\u308b\u30c7\u30fc\u30bf\u306b\u3088\u3063\u30662\u6b21\u5143\u914d\u5217\u306e\u30b5\u30a4\u30ba\u304c\u5909\u308f\u308b\u5834\u5408\u306f\u3001length\u30d7\u30ed\u30d1\u30c6\u30a3\u3092\u6d3b\u7528\u3057\u305fgetRange\u30e1\u30bd\u30c3\u30c9\u3067\u30bb\u30eb\u7bc4\u56f2\u3092\u6307\u5b9a\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<h2>\u307e\u3068\u3081\u30fb\u7d42\u308f\u308a\u306b<\/h2>\n<p>\u4eca\u56de\u3001Google Apps Script(GAS)\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u3067\u4f7f\u7528\u3059\u308b\u914d\u5217\u306e\u8981\u7d20\u6570\u30fb\u9577\u3055\u3092\u53d6\u5f97\u3059\u308b\u65b9\u6cd5\u3092\u7d39\u4ecb\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u914d\u5217\u306e\u8981\u7d20\u6570\u3092\u53d6\u5f97\u3059\u308b\u306b\u306f\u3001\u4ed6\u306e\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u8a00\u8a9e\u3068\u540c\u69d8\u306blength\u30d7\u30ed\u30d1\u30c6\u30a3\u3092\u5229\u7528\u3057\u307e\u3059\u3002<\/p>\n<p>\u8981\u7d20\u6570\u3092\u53d6\u5f97\u3057\u305f\u3044\u914d\u5217array\u306b\u5bfe\u3057\u3001\u300carray.length\u300d\u3068\u8a18\u8ff0\u3059\u308b\u3068\u8981\u7d20\u6570\u3092\u53d6\u5f97\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>for\u30eb\u30fc\u30d7\u3067\u914d\u5217\u306e\u5168\u8981\u7d20\u306b\u51e6\u7406\u3092\u884c\u3044\u305f\u3044\u5834\u5408\u3084\u3001\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8getRange\u30e1\u30bd\u30c3\u30c9\u30672\u6b21\u5143\u914d\u5217\u3092\u66f8\u304d\u8fbc\u3080\u30bb\u30eb\u7bc4\u56f2\u3092\u6307\u5b9a\u3059\u308b\u969b\u306b\u3088\u304f\u4f7f\u3044\u307e\u3059\u3002<\/p>\n<p>\u51e6\u7406\u3059\u308b\u30c7\u30fc\u30bf\u306b\u3088\u3063\u3066\u914d\u5217\u306e\u30b5\u30a4\u30ba\u304c\u5909\u308f\u308b\u5834\u5408\u306b\u3001length\u3092\u4f7f\u3046\u3068\u30a8\u30e9\u30fc\u3057\u306a\u304f\u3066\u6e08\u307f\u307e\u3059\u3002<\/p>\n<p>\u914d\u5217\u51e6\u7406\u3092\u3059\u308b\u969b\u306b\u306flength\u30d7\u30ed\u30d1\u30c6\u30a3\u3092\u4f7f\u3046\u30b1\u30fc\u30b9\u304c\u591a\u3044\u306e\u3067\u3001\u305c\u3072\u4f7f\u3044\u65b9\u3092\u30de\u30b9\u30bf\u30fc\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Google Apps Script(GAS)\u3067\u914d\u5217\u3092\u6271\u3063\u3066\u3044\u308b\u3068\u3001\u305d\u306e\u914d\u5217\u306e\u8981\u7d20\u6570\u30fb\u9577\u3055\u3092\u77e5\u308a\u305f\u3044\u5834\u5408\u304c\u3042\u308a\u307e\u3059\u3002 \u305d\u3053\u3067\u914d\u5217\u306e\u8981\u7d20\u6570\u304c\u3044\u304f\u3064\u3042\u308b\u304b\u3001\u914d\u5217\u306e\u9577\u3055\u3092\u78ba\u8a8d\u3059\u308b\u65b9\u6cd5\u3092\u89e3\u8aac\u3057\u307e\u3059\u3002 GAS\u3067\u914d\u5217\u306e\u8981\u7d20\u6570\u3092\u78ba\u8a8d\u3057 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":3898,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[14,286,708,689,284],"class_list":["post-3894","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-gas","tag-gas","tag-length","tag-708","tag-689","tag-284"],"_links":{"self":[{"href":"https:\/\/auto-worker.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3894","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/auto-worker.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/auto-worker.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/auto-worker.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/auto-worker.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3894"}],"version-history":[{"count":2,"href":"https:\/\/auto-worker.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3894\/revisions"}],"predecessor-version":[{"id":3899,"href":"https:\/\/auto-worker.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3894\/revisions\/3899"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/auto-worker.com\/blog\/index.php?rest_route=\/wp\/v2\/media\/3898"}],"wp:attachment":[{"href":"https:\/\/auto-worker.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3894"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/auto-worker.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3894"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/auto-worker.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3894"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}