{"id":2529,"date":"2021-06-12T09:29:35","date_gmt":"2021-06-12T00:29:35","guid":{"rendered":"https:\/\/for-dummies.net\/gas-noobs\/?p=2529"},"modified":"2022-04-11T10:37:33","modified_gmt":"2022-04-11T01:37:33","slug":"how-to-get-last-row-index-from-sheets-by-gas","status":"publish","type":"post","link":"https:\/\/for-dummies.net\/gas-noobs\/how-to-get-last-row-index-from-sheets-by-gas\/","title":{"rendered":"\u3010\u30b3\u30d4\u30da\u3067\u4f7f\u3048\u308b\u3011GAS\u3067\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8\u304b\u3089\u6700\u7d42\u884c\u3092\u53d6\u5f97\u3059\u308b"},"content":{"rendered":"\n<p>\u4eca\u56de\u306fGoogle Apps Script\u3092\u4f7f\u3063\u3066\u6700\u7d42\u884c\u3092\u53d6\u5f97\u3059\u308b\u65b9\u6cd5\u3092\u3044\u304f\u3064\u304b\u304a\u4f1d\u3048\u3057\u307e\u3059\u3002\u6700\u7d42\u884c\u3092\u53d6\u5f97\u3059\u308b\u65b9\u6cd5\u306f\u8907\u6570\u3042\u308a\u307e\u3059\u304c\u3001\u4f7f\u7528\u3059\u308b\u72b6\u6cc1\u306b\u3088\u3063\u3066\u9069\u3057\u305f\u30e1\u30bd\u30c3\u30c9\u304c\u7570\u306a\u308a\u307e\u3059\u306e\u3067\u3001\u3069\u306e\u3088\u3046\u306a\u5834\u5408\u306b\u4f7f\u3046\u3079\u304d\u306a\u306e\u304b\u3068\u3044\u3046\u3053\u3068\u3092\u542b\u3081\u3066\u3054\u7d39\u4ecb\u3057\u3088\u3046\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<h2>\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8\u304b\u3089\u6700\u7d42\u884c\u3092\u53d6\u5f97\u3059\u308b<\/h2>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container\">\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container\">\n\n\n<div class=\"swell-block-button is-style-btn_shiny is-style-btn_shiny\" data-id=\"ca5afbe1\"><a href=\"#1\" class=\"swell-block-button__link\" data-has-icon=\"1\"><i class=\"icon-light-bulb __icon\"><\/i><span>\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u306f\u3053\u3061\u3089<\/span><\/a><\/div>\n<\/div><\/div>\n<\/div><\/div>\n\n\n\n<p>\u4eca\u56de\u306e\u8a18\u4e8b\u3067\u306f\u3001<span class=\"swl-marker mark_orange\"><strong>\u307e\u305a\u6700\u7d42\u884c\u3068\u3044\u3046\u3082\u306e\u3092\u5b9a\u7fa9<\/strong><\/span>\u3059\u308b\u3068\u3053\u308d\u304b\u3089\u59cb\u3081\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002\u7686\u3055\u3093\u306f\u6700\u7d42\u884c\u3068\u805e\u304f\u3068\u3001\u3069\u3061\u3089\u3092\u30a4\u30e1\u30fc\u30b8\u3055\u308c\u308b\u3067\u3057\u3087\u3046\u304b\uff1f<\/p>\n\n\n\n<div class=\"wp-block-group is-style-big_icon_hatena\"><div class=\"wp-block-group__inner-container\">\n<ul class=\"is-style-check_list\"><li><strong>\u30c7\u30fc\u30bf\u304c\u5165\u3063\u3066\u3044\u308b\u6700\u7d42\u306e\u884c<\/strong><\/li><li><strong>\u30b7\u30fc\u30c8\u306e\u6700\u7d42\u884c<\/strong><\/li><\/ul>\n<\/div><\/div>\n\n\n\n<p>Google Apps Script\u3067\u306f\u3001\u3053\u306e<span class=\"swl-marker mark_orange\"><strong>\u4e0a\u8a182\u3064\u306e\u6700\u7d42\u884c\u306b\u306f\u660e\u78ba\u306a\u9055\u3044<\/strong><\/span>\u304c\u3042\u308a\u3001\u5834\u5408\u306b\u3088\u3063\u3066\u306f<span class=\"swl-marker mark_orange\"><strong>\u51e6\u7406\u7d50\u679c\u304c\u601d\u3063\u305f\u901a\u308a\u306e\u7d50\u679c\u306b\u306a\u3089\u306a\u304b\u3063\u305f\u308a<\/strong><\/span>\u3001<span class=\"swl-marker mark_orange\"><strong>\u975e\u52b9\u7387\u306a\u51e6\u7406\u306b\u306a\u3063\u3066\u3057\u307e\u3046<\/strong><\/span>\u5834\u5408\u304c\u3042\u308a\u307e\u3059\u3002<br>\u305d\u306e\u305f\u3081\u3001<span class=\"swl-marker mark_orange\"><strong>\u8907\u6570\u5b58\u5728\u3059\u308b\u6700\u7d42\u884c\u53d6\u5f97\u306e\u51e6\u7406\u306e\u7279\u6027<\/strong><\/span>\u3084<span class=\"swl-marker mark_orange\"><strong>\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8\u306e\u7279\u6027<\/strong><\/span>\u3092<span class=\"swl-marker mark_orange\"><strong>\u5341\u5206\u306b\u7406\u89e3\u3059\u308b\u3053\u3068\u304c\u5fc5\u8981<\/strong><\/span>\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p class=\"is-style-icon_info\">\u7d50\u8ad6\u3068\u3057\u3066\u306f\u3001\u4e0a\u8a18\u306e\u3069\u3061\u3089\u3082\u6700\u7d42\u884c\u306b\u306a\u308a\u5f97\u308b\u3068\u79c1\u306f\u8003\u3048\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u4f8b\u3048\u3070\u3001\u898b\u305f\u76ee\u306f\u540c\u3058\u3088\u3046\u306b\u898b\u3048\u308b2\u3064\u306e\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8\u30d5\u30a1\u30a4\u30eb\u3092\u7528\u610f\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<ul class=\"is-style-check_list -list-under-dashed\"><li><span class=\"swl-marker mark_orange\"><strong>\u4f55\u3082\u30c7\u30fc\u30bf\u304c\u306a\u304f\u7a7a\u6b04<\/strong><\/span>\u3001<\/li><li><span class=\"swl-marker mark_orange\"><strong>A\u5217\u306b1000\u884c\u76ee\u307e\u3067\u95a2\u6570\u304c\u5165\u3063\u3066\u3044\u308b\u3051\u308c\u3069\u3082\u95a2\u6570\u306e\u51fa\u529b\u7d50\u679c\u304c\u7a7a\u6b04<\/strong><\/span><\/li><\/ul>\n\n\n\n<p><span class=\"swl-marker mark_orange\"><strong>\u3069\u3061\u3089\u3082\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8\u306e\u898b\u305f\u76ee\u306f\u4f55\u3082\u51fa\u529b\u3055\u308c\u3066\u3044\u306a\u3044\u7a7a\u306e\u30b7\u30fc\u30c8<\/strong><\/span>\u3067\u3059\u3002<br>\u305f\u3060\u3057\u3001\u30c7\u30fc\u30bf\u304c\u5165\u3063\u3066\u3044\u308b\u6700\u7d42\u884c\u3068\u3044\u3046\u98a8\u306b\u8cea\u554f\u3059\u308c\u3070\u3001\uff12\u3064\u306e\u30b7\u30fc\u30c8\u3067\u7b54\u3048\u306f\u7570\u306a\u308a\u307e\u3059\u3002<br><span class=\"swl-marker mark_orange\"><strong>\u3053\u306e\u8a8d\u8b58\u306e\u9055\u3044\u304c\u3001\u30d7\u30ed\u30b0\u30e9\u30e0\u306b\u3082\u5f71\u97ff\u3092\u4e0e\u3048\u308b<\/strong><\/span>\u306e\u3067\u3059\u3002<\/p>\n\n\n\n<h3>GAS\u3067\u6700\u7d42\u884c\u3092\u53d6\u5f97\u3059\u308b\u30e1\u30bd\u30c3\u30c9<\/h3>\n\n\n\n<div class=\"wp-block-group has-border -border01\"><div class=\"wp-block-group__inner-container\">\n<p>GAS\u3067\u6700\u7d42\u884c\u3092\u53d6\u5f97\u3059\u308b\u65b9\u6cd5\u3092\uff14\u3064\u3054\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<ul class=\"is-style-check_list -list-under-dashed\"><li><strong>getLastRow()<\/strong><\/li><li><strong>getMaxRows()<\/strong><\/li><li><strong>getRow()\/getRowIndex()<\/strong><\/li><li><strong>getDataRange().getValues().length<\/strong><\/li><\/ul>\n\n\n\n<p>\u6700\u7d42\u5217\u3092\u53d6\u5f97\u3059\u308b\u65b9\u6cd5\u3082\u4e0a\u8a18\u3068\u540c\u3058\u3088\u3046\u306b\uff14\u3064\u3054\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<ol id=\"block-68e5a3b1-9d5a-4934-8952-8ad9876c0f99\" class=\"is-style-check_list -list-under-dashed\"><li><strong>getLastColumn()<\/strong><\/li><li><strong>getMaxColumns()<\/strong><\/li><li><strong>getColumn()\/getColumnIndex()<\/strong><\/li><li><strong>getDataRange().getValues()[0].length<\/strong><\/li><\/ol>\n\n\n\n<p>\u3069\u3061\u3089\u3082\u4f7f\u3044\u65b9\u306f\u307b\u3069\u5909\u308f\u308a\u307e\u305b\u3093\u306e\u3067\u3001\u6700\u7d42\u5217\u306e\u3053\u3068\u3092\u77e5\u308a\u305f\u3044\u5834\u5408\u306f\u6587\u4e2d\u306e\u6700\u7d42\u884c\u3092\u8aad\u307f\u66ff\u3048\u3066\u3044\u305f\u3060\u3051\u308c\u3070\u826f\u3044\u304b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<\/div><\/div>\n\n\n\n<p>\u307e\u305a\u306f\u3001\u672c\u984c\u306b\u5165\u308b\u524d\u306b\u3001GAS\u3067\u6700\u7d42\u884c\u3092\u53d6\u5f97\u3059\u308b\u30e1\u30bd\u30c3\u30c9\u3092\u3054\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u3069\u3061\u3089\u3082\u4f7f\u3044\u65b9\u306f\u307b\u3069\u5909\u308f\u308a\u307e\u305b\u3093\u306e\u3067\u3001<span class=\"swl-marker mark_orange\"><strong>\u4eca\u56de\u306e\u8a18\u4e8b\u3067\u306f\u6700\u7d42\u884c\u3092\u30e1\u30a4\u30f3\u3068\u3057\u3066\u8aac\u660e<\/strong><\/span>\u3092\u3057\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<br>\u6700\u7d42\u5217\u306e\u3053\u3068\u3092\u77e5\u308a\u305f\u3044\u5834\u5408\u306f\u5fc5\u8981\u306b\u5fdc\u3058\u3066\u6587\u4e2d\u306e\u6700\u7d42\u884c\u3092\u6700\u7d42\u5217\u3068\u8aad\u307f\u66ff\u3048\u3066\u3044\u305f\u3060\u3051\u308c\u3070\u826f\u3044\u304b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<h2>\u6700\u7d42\u884c\u53d6\u5f97\u306e\u95a2\u6570\u306e\u51fa\u529b\u7d50\u679c\u3092\u6bd4\u3079\u3066\u307f\u308b<\/h2>\n\n\n\n<p>\u524d\u7f6e\u304d\u304c\u9577\u304f\u306a\u308a\u307e\u3057\u305f\u304c\u3001\u4eca\u56de\u306e\u672c\u984c\u306b\u5165\u3063\u3066\u3044\u304d\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<br>\u672c\u8a18\u4e8b\u3067\u306f\u3001\u4e0b\u8a18\u306e\uff13\u30d1\u30bf\u30fc\u30f3\u306b\u5206\u3051\u3066\u3054\u8aac\u660e\u3092\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"wp-block-group has-border -border02\"><div class=\"wp-block-group__inner-container\">\n<ul class=\"is-style-check_list\"><li><span class=\"swl-marker mark_orange\"><strong>\u30b7\u30fc\u30c8A<\/strong><\/span>\uff08\u5024\u3084\u95a2\u6570\u304c4\u884c\u76ee\u307e\u3067\u5165\u3063\u3066\u3044\u308b\u30b7\u30fc\u30c8\uff085\u884c\u76ee\u4ee5\u4e0b\u306f\u4f55\u3082\u5165\u3063\u3066\u3044\u306a\u3044\uff09<\/li><li><span class=\"swl-marker mark_yellow\"><strong>\u30b7\u30fc\u30c8B<\/strong><\/span>\uff08C\u5217\u306b\u306f1\u884c\u76ee\u304b\u30891000\u884c\u76ee\u307e\u3067\u95a2\u6570\u304c\u5165\u3063\u3066\u3044\u308b\u304c\u30015\u884c\u76ee\u4ee5\u964d\u306f\u7a7a\u6b04\u304c\u51fa\u529b\u3055\u308c\u3066\u3044\u308b\u30b7\u30fc\u30c8\uff09<\/li><li><span class=\"swl-marker mark_green\"><strong>\u30b7\u30fc\u30c8C<\/strong><\/span>\uff081\u884c\u76ee\u304b\u30891000\u884c\u76ee\u307e\u3067\u5024\u3084\u95a2\u6570\u304c\u5165\u3063\u3066\u3044\u308b\u30b7\u30fc\u30c8\uff09<\/li><\/ul>\n<\/div><\/div>\n\n\n\n<div class=\"swell-block-button is-style-btn_normal is-style-btn_normal is-style-btn_normal is-style-btn_normal\" data-id=\"d5f9cabd\"><a href=\"https:\/\/docs.google.com\/spreadsheets\/d\/1QKwJjfLs3hesMQNqandsR2wWLeVx0lGHzSpdr5xUfqI\/edit#gid=1527424811\" target=\"_blank\" rel=\"noopener noreferrer\" class=\"swell-block-button__link\" data-has-icon=\"1\"><i class=\"icon-light-bulb __icon\"><\/i><span>\u30b5\u30f3\u30d7\u30eb\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8<\/span><\/a><\/div>\n\n\n\n<p>\u3053\u306e3\u3064\u306e\u30b7\u30fc\u30c8\u3067\u3001\u6700\u7d42\u884c\u53d6\u5f97\u306e\u95a2\u6570\u306e\u5b9f\u884c\u7d50\u679c\u3092\u78ba\u8a8d\u3057\u3066\u307f\u3088\u3046\u3068\u601d\u3044\u307e\u3059\u3002\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8\u306e\u4e0a\u90e8\u306b\u306f\u3001<strong>\u300e\u6700\u7d42\u884c\u3092\u53d6\u5f97\u3059\u308b\u3042\u308c\u3053\u308c\u300f<\/strong>\u3068\u3044\u3046\u30ab\u30b9\u30bf\u30e0\u30e1\u30cb\u30e5\u30fc\u3092\u7528\u610f\u3057\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img width=\"766\" height=\"517\" src=\"https:\/\/i1.wp.com\/for-dummies.net\/gas-noobs\/wp-content\/uploads\/2021\/06\/Screenshot-2021-06-12-00.30.48.png?resize=766%2C517&#038;ssl=1\" alt=\"\" class=\"wp-image-2531\" srcset=\"https:\/\/i1.wp.com\/for-dummies.net\/gas-noobs\/wp-content\/uploads\/2021\/06\/Screenshot-2021-06-12-00.30.48.png?w=766&amp;ssl=1 766w, https:\/\/i1.wp.com\/for-dummies.net\/gas-noobs\/wp-content\/uploads\/2021\/06\/Screenshot-2021-06-12-00.30.48.png?resize=300%2C202&amp;ssl=1 300w, https:\/\/i1.wp.com\/for-dummies.net\/gas-noobs\/wp-content\/uploads\/2021\/06\/Screenshot-2021-06-12-00.30.48.png?resize=304%2C205&amp;ssl=1 304w, https:\/\/i1.wp.com\/for-dummies.net\/gas-noobs\/wp-content\/uploads\/2021\/06\/Screenshot-2021-06-12-00.30.48.png?resize=282%2C190&amp;ssl=1 282w\" sizes=\"(max-width: 766px) 100vw, 766px\" data-recalc-dims=\"1\" \/><\/figure>\n\n\n\n<div class=\"wp-block-group has-border -border02\"><div class=\"wp-block-group__inner-container\">\n<p>\u30ab\u30b9\u30bf\u30e0\u30e1\u30cb\u30e5\u30fc\u306b\u306f\u3001\u4e0b\u8a18\u306e5\u3064\u306e\u9078\u629e\u80a2\u304c\u9078\u629e\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<ol class=\"is-style-check_list\"><li><strong>getLastRow<\/strong><\/li><li><strong>getMaxRows<\/strong><\/li><li><strong>getRow<\/strong><\/li><li><strong>length<\/strong><\/li><li><strong>getRowUpwards<\/strong><\/li><\/ol>\n<\/div><\/div>\n\n\n\n<div class=\"swell-block-button is-style-btn_normal is-style-btn_normal is-style-btn_normal is-style-btn_normal\"><a href=\"https:\/\/script.google.com\/d\/1LxSpRGEDiQC3mrfFo9p_ny4ZuI8DAhGE9OwV648EPsjKzAHnrCIsproO\/edit?usp=sharing\" target=\"_blank\" rel=\"noopener noreferrer\" class=\"swell-block-button__link\"><span>\u30b7\u30fc\u30c8\u306e\u6700\u7d42\u884c\u3092\u53d6\u5f97\u3059\u308b\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9<\/span><\/a><\/div>\n\n\n\n<h2 id=\"1\">\u6700\u7d42\u884c\u3092\u53d6\u5f97\u3059\u308b\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9<\/h2>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-js\" data-file=\"\u6700\u7d42\u884c\u3092\u53d6\u5f97\u3059\u308b\u95a2\u6570\u305f\u3061\" data-lang=\"JavaScript\"><code>\/\/getLastRow\u95a2\u6570\u3067\u6700\u7d42\u884c\u3092\u53d6\u5f97\u3059\u308b\u30b3\u30fc\u30c9\nfunction sampleCodeForGetLastRow() {\n  let sheet = SpreadsheetApp.getActiveSheet();\n  let lastRow = sheet.getLastRow();\n  let msg = &quot;getLastRow\u3067\u53d6\u5f97\u3057\u305f\u6700\u7d42\u884c\uff1a&quot; + lastRow + &quot; \u884c&quot;;\n  showDialog(msg);\n}\n\n\/\/getMaxRows\u95a2\u6570\u3067\u6700\u7d42\u884c\u3092\u53d6\u5f97\u3059\u308b\u30b3\u30fc\u30c9\nfunction sampleCodeForGetMaxRows() {\n  let sheet = SpreadsheetApp.getActiveSheet();\n  let lastRow = sheet.getMaxRows();\n  let msg = &quot;getMaxRows\u3067\u53d6\u5f97\u3057\u305f\u6700\u7d42\u884c\uff1a&quot; + lastRow + &quot; \u884c&quot;;\n  showDialog(msg);\n}\n\n\/\/getRow\u95a2\u6570\u3067A\u5217\u306e\u6700\u7d42\u884c\u3092\u53d6\u5f97\u3059\u308b\u30b3\u30fc\u30c9\nfunction sampleCodeForGetRow() {\n  let sheet = SpreadsheetApp.getActiveSheet();\n  let range = sheet.getRange(1, 1).getNextDataCell(SpreadsheetApp.Direction.DOWN);\n  let lastRow = range.getRow();\n  let msg = &quot;getRow\u3067\u53d6\u5f97\u3057\u305f\u6700\u7d42\u884c\uff1a&quot; + lastRow + &quot; \u884c&quot;;\n  showDialog(msg);\n}\n\n\/\/\u30b7\u30fc\u30c8\u306e\u5024\u3092\u3059\u3079\u3066\u4e8c\u6b21\u5143\u914d\u5217\u3067\u53d6\u5f97\u3057\u3001length\u95a2\u6570\u3067\u6700\u7d42\u884c\u3092\u53d6\u5f97\u3059\u308b\u30b3\u30fc\u30c9\nfunction sampleCodeForLength() {\n  let sheet = SpreadsheetApp.getActiveSheet();\n  let data = sheet.getDataRange().getValues()\n  let lastRow = data.length;\n  let msg = &quot;getLastRow\u3067\u53d6\u5f97\u3057\u305f\u6700\u7d42\u884c\uff1a&quot; + lastRow + &quot; \u884c&quot;;\n  showDialog(msg);\n}<\/code><\/pre><\/div>\n\n\n\n<p>\u30ab\u30b9\u30bf\u30e0\u30e1\u30cb\u30e5\u30fc\u3092\u5b9f\u884c\u3059\u308b\u3068<span class=\"swl-marker mark_orange\"><strong>\u958b\u3044\u3066\u3044\u308b\u30b7\u30fc\u30c8\uff08\u30b7\u30fc\u30c8A\/\u30b7\u30fc\u30c8B\/\u30b7\u30fc\u30c8C\uff09\u306e\u6700\u7d42\u884c\u3092\u305d\u308c\u305e\u308c\u306e\u51e6\u7406\u65b9\u6cd5\u3067\u53d6\u5f97\u3057\u3001\u30c0\u30a4\u30a2\u30ed\u30b0\u3067\u8868\u793a<\/strong><\/span>\u3055\u305b\u308b\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"swell-block-button is-style-btn_normal is-style-btn_normal is-style-btn_normal is-style-btn_normal\"><a href=\"https:\/\/docs.google.com\/spreadsheets\/d\/1QKwJjfLs3hesMQNqandsR2wWLeVx0lGHzSpdr5xUfqI\/edit#gid=1527424811\" target=\"_blank\" rel=\"noopener noreferrer\" class=\"swell-block-button__link\"><span>\u30b5\u30f3\u30d7\u30eb\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8<\/span><\/a><\/div>\n\n\n\n<p>\u81ea\u5206\u3067\u3082\u30b7\u30fc\u30c8\u306b\u30a2\u30af\u30bb\u30b9\u3057\u3066\u305c\u3072\u95a2\u6570\u3092\u5b9f\u884c\u3057\u3066\u307f\u3066\u4e0b\u3055\u3044\u3002<\/p>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container\">\n<p>\u4e00\u756a\u6700\u521d\u306b\u5b9f\u884c\u3059\u308b\u3068\u304d\u3060\u3051\u30b9\u30af\u30ea\u30d7\u30c8\u306b\u8a31\u53ef\u3092\u6c42\u3081\u3089\u308c\u307e\u3059\u306e\u3067\u3001\u4e0b\u8a18\u8a18\u4e8b\u306e\u624b\u9806\u306b\u5f93\u3063\u3066GAS\u306b\u5b9f\u884c\u8a31\u53ef\u306e\u4ed8\u4e0e\u3092\u304a\u9858\u3044\u3057\u307e\u3059\u3002<\/p>\n\n\n<div class=\"swell-block-postLink\" data-style=\"card\">\t\t\t<div class=\"p-blogCard -internal\" data-type=\"type1\" data-onclick=\"clickLink\">\n\t\t\t\t<div class=\"p-blogCard__inner\">\n\t\t\t\t\t<span class=\"p-blogCard__caption\">\u3042\u308f\u305b\u3066\u8aad\u307f\u305f\u3044<\/span>\n\t\t\t\t\t<div class=\"p-blogCard__thumb c-postThumb\"><figure class=\"c-postThumb__figure\"><img src=\"https:\/\/i0.wp.com\/for-dummies.net\/gas-noobs\/wp-content\/uploads\/2018\/06\/script-editor-1.png?fit=300%2C158&#038;ssl=1\" alt=\"\" class=\"c-postThumb__img u-obf-cover\" width=\"320\" height=\"180\"><\/figure><\/div>\t\t\t\t\t<div class=\"p-blogCard__body\">\n\t\t\t\t\t\t<a class=\"p-blogCard__title\" href=\"https:\/\/for-dummies.net\/gas-noobs\/how-to-set-gas-scopes-for-free-google-account\/\">\u7121\u6599\u306e\u30a2\u30ab\u30a6\u30f3\u30c8\u3067GAS\u306b\u521d\u56de\u306e\u5b9f\u884c\u8a31\u53ef\u3092\u4e0e\u3048\u308b\u65b9\u6cd5\u3010\u8d85\u5165\u9580\u3011<\/a>\n\t\t\t\t\t\t<span class=\"p-blogCard__excerpt\">\u4eca\u56de\u3068\u6b21\u56de\u306e\u6295\u7a3f\u3067\u306f\u3001Google Apps Script\u3067\u305d\u306e\u4ed6\u306eG Suite\u30b5\u30fc\u30d3\u30b9\u306e\u64cd\u4f5c\u3092\u884c\u3046\u969b\u306b\u5fc5\u8981\u306a\u30a2\u30af\u30bb\u30b9\u8a31\u53ef\u306b\u3064\u3044\u3066\u8aac\u660e\u3057\u307e\u3059\u3002Google\u30a2\u30ab\u30a6\u30f3\u30c8\u306b\u306f\u7121\u6599\u306eGoogle\u30a2\u30ab\u30a6&#8230;<\/span>\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t<\/div>\n\t\t<\/div><\/div><\/div>\n\n\n\n<h3>\u30b9\u30af\u30ea\u30d7\u30c8\u306e\u5b9f\u884c\u7d50\u679c<\/h3>\n\n\n\n<figure class=\"wp-block-table is-style-regular td_to_th_\"><table><thead><tr><th>\u30b7\u30fc\u30c8\u540d<\/th><th class=\"has-text-align-center\" data-align=\"center\">getLastRow<\/th><th class=\"has-text-align-center\" data-align=\"center\">getMaxRow<\/th><th class=\"has-text-align-center\" data-align=\"center\">getRow<\/th><th class=\"has-text-align-center\" data-align=\"center\">length<\/th><th class=\"has-text-align-center\" data-align=\"center\">getRowUpwards<\/th><\/tr><\/thead><tbody><tr><td>\u30b7\u30fc\u30c8A<\/td><td class=\"has-text-align-center\" data-align=\"center\"><span class=\"swl-marker mark_blue\">\uff14\u884c<\/span><\/td><td class=\"has-text-align-center\" data-align=\"center\"><span class=\"swl-marker mark_orange\">1000\u884c<\/span><\/td><td class=\"has-text-align-center\" data-align=\"center\"><span class=\"swl-marker mark_blue\">4\u884c<\/span><\/td><td class=\"has-text-align-center\" data-align=\"center\"><span class=\"swl-marker mark_blue\">4\u884c<\/span><\/td><td class=\"has-text-align-center\" data-align=\"center\"><span class=\"swl-marker mark_blue\">4\u884c<\/span><\/td><\/tr><tr><td>\u30b7\u30fc\u30c8B<\/td><td class=\"has-text-align-center\" data-align=\"center\"><span class=\"swl-marker mark_orange\">1000\u884c<\/span><\/td><td class=\"has-text-align-center\" data-align=\"center\"><span class=\"swl-marker mark_orange\">1000\u884c<\/span><\/td><td class=\"has-text-align-center\" data-align=\"center\"><span class=\"swl-marker mark_blue\">4\u884c<\/span><\/td><td class=\"has-text-align-center\" data-align=\"center\"><span class=\"swl-marker mark_orange\">1000\u884c<\/span><\/td><td class=\"has-text-align-center\" data-align=\"center\"><span class=\"swl-marker mark_blue\">4\u884c<\/span><\/td><\/tr><tr><td>\u30b7\u30fc\u30c8C<\/td><td class=\"has-text-align-center\" data-align=\"center\"><span class=\"swl-marker mark_orange\">1000\u884c<\/span><\/td><td class=\"has-text-align-center\" data-align=\"center\"><span class=\"swl-marker mark_orange\">1000\u884c<\/span><\/td><td class=\"has-text-align-center\" data-align=\"center\"><span class=\"swl-marker mark_orange\">1000\u884c<\/span><\/td><td class=\"has-text-align-center\" data-align=\"center\"><span class=\"swl-marker mark_orange\">1000\u884c<\/span><\/td><td class=\"has-text-align-center\" data-align=\"center\"><span class=\"swl-marker mark_green\">1\u884c<\/span><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>\u30b7\u30fc\u30c8\u306b\u5165\u3063\u3066\u3044\u308b\u30c7\u30fc\u30bf\u306b\u3088\u3063\u3066\u305d\u308c\u305e\u308c\u306e\u95a2\u6570\u306e\u51fa\u529b\u7d50\u679c\u304c\u5909\u308f\u3063\u3066\u3044\u308b\u306e\u304c\u308f\u304b\u308a\u307e\u3059\u3002<br>\u305d\u308c\u305e\u308c\u306e\u95a2\u6570\u306e\u7279\u5fb4\u3092\u8868\u3057\u3066\u3044\u307e\u3059\u306d\u3002<\/p>\n\n\n\n<h2>\u305d\u308c\u305e\u308c\u95a2\u6570\u306e\u89e3\u8aac<\/h2>\n\n\n\n<h3>\u2460 getLastRow<\/h3>\n\n\n\n<p>\u3053\u3061\u3089\u306e\u95a2\u6570\u306f\u3001\u30b7\u30fc\u30c8\u306e\u4e2d\u3067<span class=\"swl-marker mark_orange\"><strong>\u30c7\u30fc\u30bf\uff08\u5024\u3084\u6570\u5f0f\uff09\u304c\u5165\u3063\u3066\u3044\u308b\u6700\u7d42\u884c\u3092\u53d6\u5f97<\/strong><\/span>\u3059\u308b\u3088\u3046\u306a\u6319\u52d5\u3092\u3057\u307e\u3059\u3002<br>\u305d\u306e\u305f\u3081\u3001<span class=\"swl-marker mark_orange\"><strong>4\u884c\u76ee\u307e\u3067\u3057\u304b\u30c7\u30fc\u30bf\u304c\u5165\u3063\u3066\u3044\u306a\u3051\u308c\u30704\u884c\u76ee\u304c\u6700\u7d42\u884c\u3068\u3057\u3066\u53d6\u5f97<\/strong><\/span>\u3055\u308c\u307e\u3059\u3002<br><span class=\"swl-marker mark_orange\"><strong>\u6ce8\u76ee\u3057\u305f\u3044\u7279\u5fb4\u3068\u3057\u3066\u306f\u3001\u6570\u5f0f\u306e\u5834\u5408\u306f\u51fa\u529b\u304c\u7a7a\u6b04\u3067\u51fa\u529b\u3055\u308c\u3066\u3044\u305f\u3068\u3057\u3066\u3082\u30c7\u30fc\u30bf\u304c\u5165\u3063\u3066\u3044\u308b\u3068\u307f\u306a\u3055\u308c\u3066\u3057\u307e\u3046<\/strong><\/span>\u3053\u3068\u3067\u3059\u3002<br>\u3053\u3061\u3089\u306e\u95a2\u6570\u3067\u3088\u304f\u3084\u3063\u3066\u3057\u307e\u3046\u4e8b\u3068\u3057\u3066\u3001<span class=\"swl-marker mark_orange\"><strong>\u6570\u5f0f\u304c\u5927\u91cf\u306b\u5165\u3063\u3066\u3044\u308b\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8\u3067\u6700\u7d42\u884c\u307e\u3067\u30eb\u30fc\u30d7\u3067\u51e6\u7406\u3092\u3057\u3088\u3046\u3068\u3057\u3066\u3001\u95a2\u6570\u306e\u51fa\u529b\u7d50\u679c\u3067\u4f55\u3082\u30c7\u30fc\u30bf\u304c\u51fa\u529b\u3055\u308c\u3066\u3044\u306a\u3044\u884c\u306b\u5bfe\u3057\u3066\u3082\u51e6\u7406\u3092\u7e70\u308a\u8fd4\u3057\u3066\u3057\u307e\u3046<\/strong><\/span>\u3053\u3068\u304c\u5c11\u306a\u304f\u3042\u308a\u307e\u305b\u3093\u3002<br>\u7121\u99c4\u306a\u51e6\u7406\u304c\u591a\u304f\u306a\u308a\u307e\u3059\u306e\u3067\u3001\u52d5\u4f5c\u304c\u9045\u304f\u306a\u3063\u3066\u3057\u307e\u3046\u305f\u3081\u3001\u6c17\u3092\u3064\u3051\u305f\u3044\u70b9\u3067\u3059\u3002<br><span class=\"swl-marker mark_orange\"><strong>ARRAYFORMULA\u95a2\u6570\u3092\u4f7f\u3063\u305f\u5834\u5408\u3082\u3001\u6700\u5927\u51fa\u529b\u884c\u307e\u3067\u304c\u30c7\u30fc\u30bf\u304c\u5165\u3063\u3066\u3044\u308b\u3082\u306e\u3068\u3057\u3066\u51e6\u7406\u3055\u308c\u307e\u3059<\/strong><\/span>\u306e\u3067\u3001\u300e=ARRAYFOMULA(A2:A10000+B2:B10000)\u300f\u306a\u3093\u3066\u3044\u3046\u95a2\u6570\u304c\u3042\u3063\u305f\u5834\u5408\u306b\u306f\u4f55\u3082\u30c7\u30fc\u30bf\u304c\u306a\u304f\u3066\u3082\u7121\u99c4\u306b10,000\u884c\u76ee\u307e\u3067\u306e\u51e6\u7406\u3092\u3057\u3066\u3057\u307e\u3044\u307e\u3059\u306e\u3067\u3001\u7121\u99c4\u306a\u51e6\u7406\u3092\u3057\u306a\u3044\u3088\u3046\u306b\u6ce8\u610f\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<p class=\"is-style-big_icon_batsu\"><span class=\"swl-marker mark_orange\"><strong>ARRAYFORMULA\u95a2\u6570\u3068\u306f\u76f8\u6027\u304c\u60aa\u3044<\/strong><\/span><\/p>\n\n\n\n<h3>\u2461 getMaxRows<\/h3>\n\n\n\n<p>\u3053\u3061\u3089\u306e\u95a2\u6570\u306f\u30bb\u30eb\u306b\u30c7\u30fc\u30bf\u304c\u5165\u3063\u3066\u3044\u308b\u304b\u3069\u3046\u304b\u306b\u95a2\u308f\u3089\u305a\u3001\u5e38\u306b\u30b7\u30fc\u30c8\u306b\u8868\u793a\u3055\u308c\u3066\u3044\u308b\u4e00\u756a\u4e0b\u306e\u884c\u6570\u304c\u53d6\u5f97\u3055\u308c\u307e\u3059\u3002\u4eca\u56de\u306e\u30b5\u30f3\u30d7\u30eb\u30d5\u30a1\u30a4\u30eb\u3067\u306f\u3001\u3059\u3079\u3066\u306e\u30b7\u30fc\u30c8\u304c1,000\u884c\u306e\u3042\u308a\u307e\u3059\u306e\u3067\u3001\u3069\u306e\u30b7\u30fc\u30c8\u3067\u30821,000\u884c\u76ee\u304c\u51fa\u529b\u3055\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<p class=\"is-style-big_icon_check\"><strong>\u300e<\/strong><span class=\"swl-marker mark_orange\"><strong>\u30c7\u30fc\u30bf\u306e\u6709\u7121\u306b\u95a2\u308f\u3089\u305a\u3001\u30b7\u30fc\u30c8\u306e\u6700\u7d42\u884c\u3092\u5e38\u306b\u53d6\u5f97\u3057\u305f\u3044\uff01<\/strong><\/span>\u300f\u3068\u3044\u3046\u3068\u304d\u306f\u3053\u306e\u95a2\u6570\u3092\u4f7f\u3044\u307e\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<h3>\u2462 getRow\/getRowIndex<\/h3>\n\n\n\n<p>\u3053\u306e\u95a2\u6570\u306f<span class=\"swl-marker mark_orange\"><strong>\u53d6\u5f97\u3057\u305f\u30bb\u30eb\u306e\u884c\u6570\u3092\u8fd4\u3059<\/strong><\/span>\u3068\u3044\u3046\u95a2\u6570\u306b\u306a\u308a\u307e\u3059\u3002<br>\u305d\u306e\u305f\u3081\u4e8b\u524d\u306bgetRange\u3092\u4f7f\u3063\u3066\u30bb\u30eb\u3092\u53d6\u5f97\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<br>\u30b7\u30fc\u30c8\u306e\u6700\u7d42\u884c\u3092\u53d6\u5f97\u3059\u308b\u305f\u3081\u306b\u306fgetMaxRows\u3092\u4f7f\u3048\u3070\u4e8b\u8db3\u308a\u307e\u3059\u304b\u3089\u3001\u3053\u306e\u95a2\u6570\u3067\u306f\u3001\u95a2\u6570\u304c\u5927\u91cf\u306b\u5165\u3063\u3066\u3044\u308b\u30b7\u30fc\u30c8\u3067\u7279\u5b9a\u306e\u5217\u306e\u6700\u7d42\u884c\u3092\u53d6\u5f97\u3059\u308b\u4e8b\u306b\u5fdc\u7528\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<p class=\"is-style-big_icon_point\"><span class=\"swl-marker mark_orange\"><strong>getRange\u95a2\u6570<\/strong><\/span>\u3001<span class=\"swl-marker mark_orange\"><strong>getNextDataCell\u95a2\u6570<\/strong><\/span>\u3001<span class=\"swl-marker mark_orange\"><strong>SpreadsheetApp.Direction.Down\u95a2\u6570<\/strong><\/span>\u3068\u4f75\u7528\u3057\u3066\u6700\u7d42\u884c\u3092\u53d6\u5f97\u3067\u304d\u308b<\/p>\n\n\n\n<p><strong>getNextDataCell\u95a2\u6570<\/strong>\u306f\u3001\u5229\u7528\u3057\u305f\u3053\u3068\u304c\u306a\u3044\u65b9\u3082\u3044\u308b\u3068\u306f\u601d\u3044\u307e\u3059\u304c\u3001\u7c21\u5358\u306b\u8aac\u660e\u3059\u308b\u3068\u9078\u629e\u4e2d\u306e\u30bb\u30eb\u304b\u3089\u4e0a\u4e0b\u5de6\u53f3\u6307\u5b9a\u3057\u305f\u65b9\u5411\u306e\u30bb\u30eb\u306b\u30c7\u30fc\u30bf\u304c\u5165\u3063\u3066\u3044\u308b\u30bb\u30eb\u307e\u3067\u79fb\u52d5\u3059\u308b\u3088\u3046\u306a\u95a2\u6570\u3067\u3059\u3002<br><span class=\"swl-marker mark_orange\"><strong>Ctrl+\u77e2\u5370\u30ad\u30fc\u3092\u62bc\u3057\u305f\u3068\u304d\u306e\u6319\u52d5\u3068\u540c\u3058<\/strong><\/span>\u3068\u30a4\u30e1\u30fc\u30b8\u3057\u3066\u3082\u3089\u3048\u308c\u3070\u826f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<br>\u4f8b\u3048\u3070\u3001\u30b5\u30f3\u30d7\u30eb\u30d5\u30a1\u30a4\u30eb\u306e\u300e4\u884c\u76ee\u307e\u3067\u30c7\u30fc\u30bf\u3042\u308a\u300f\u30b7\u30fc\u30c8\u306eA1\u306b\u30a2\u30af\u30c6\u30a3\u30d6\u30bb\u30eb\u304c\u3042\u308b\u5834\u5408\u306b\u3001Ctrl+\u2193\u30ad\u30fc\u3092\u62bc\u3059\u3068\u30014\u884c\u76ee\u306b\u30a2\u30af\u30c6\u30a3\u30d6\u30bb\u30eb\u304c\u79fb\u52d5\u3057\u307e\u3059\u3002\u3082\u3046\u4e00\u5ea6Ctrl+\u2193\u30ad\u30fc\u3092\u62bc\u3059\u3068\u3001\u4eca\u5ea6\u306f1,000\u884c\u76ee\u307e\u3067\u30a2\u30af\u30c6\u30a3\u30d6\u30bb\u30eb\u304c\u79fb\u52d5\u3057\u307e\u3059\u3002<br>\u3053\u306e\u3088\u3046\u306bgetNextDataCell\u95a2\u6570\u306f\u3053\u308c\u3068\u540c\u3058\u52d5\u304d\u3092\u30d7\u30ed\u30b0\u30e9\u30e0\u7684\u306b\u5b9f\u884c\u3059\u308b\u30a4\u30e1\u30fc\u30b8\u3067\u3059\u3002<br><span class=\"swl-marker mark_orange\"><strong>\u30b5\u30f3\u30d7\u30eb\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8\u306egetRow<\/strong><\/span>\u3092\u30af\u30ea\u30c3\u30af\u3059\u308b\u3068\u3001\u307e\u305a\u306f<span class=\"swl-marker mark_orange\"><strong>\u30d7\u30ed\u30b0\u30e9\u30e0\u3067A1\u30bb\u30eb\u304c\u30a2\u30af\u30c6\u30a3\u30d6\u30bb\u30eb\u3068\u306a\u308a\u3001\u305d\u3053\u304b\u3089\u4e0b\u65b9\u5411\u306b\u30c7\u30fc\u30bf\u304c\u5165\u3063\u3066\u3044\u308b\u30bb\u30eb\u306b\u30b8\u30e3\u30f3\u30d7\u3057\u3066\u884c\u3092\u53d6\u5f97<\/strong><\/span>\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img width=\"954\" height=\"920\" src=\"https:\/\/i1.wp.com\/for-dummies.net\/gas-noobs\/wp-content\/uploads\/2021\/06\/Direction_DOWN.png?resize=954%2C920&#038;ssl=1\" alt=\"Direction_Dow\" class=\"wp-image-2534\" srcset=\"https:\/\/i1.wp.com\/for-dummies.net\/gas-noobs\/wp-content\/uploads\/2021\/06\/Direction_DOWN.png?w=954&amp;ssl=1 954w, https:\/\/i1.wp.com\/for-dummies.net\/gas-noobs\/wp-content\/uploads\/2021\/06\/Direction_DOWN.png?resize=300%2C289&amp;ssl=1 300w, https:\/\/i1.wp.com\/for-dummies.net\/gas-noobs\/wp-content\/uploads\/2021\/06\/Direction_DOWN.png?resize=768%2C741&amp;ssl=1 768w, https:\/\/i1.wp.com\/for-dummies.net\/gas-noobs\/wp-content\/uploads\/2021\/06\/Direction_DOWN.png?resize=222%2C214&amp;ssl=1 222w, https:\/\/i1.wp.com\/for-dummies.net\/gas-noobs\/wp-content\/uploads\/2021\/06\/Direction_DOWN.png?resize=270%2C260&amp;ssl=1 270w\" sizes=\"(max-width: 954px) 100vw, 954px\" data-recalc-dims=\"1\" \/><\/figure>\n\n\n\n<p>C\u5217\u306b1000\u884c\u76ee\u307e\u3067\u6570\u5f0f\u304c\u5165\u3063\u3066\u3044\u3066\u3082A\u5217\u306e\u30c7\u30fc\u30bf\u304c4\u884c\u76ee\u307e\u3067\u3057\u304b\u306a\u3051\u308c\u30704\u884c\u76ee\u304c\u6700\u7d42\u884c\u306b\u306a\u308b\u3068\u3044\u3046\u5f62\u306b\u306a\u308a\u307e\u3059\u3002<br>\u3061\u306a\u307f\u306b\u3001<span class=\"swl-marker mark_orange\"><strong>A1\u30bb\u30eb\u3092\u542b\u3081\u3066A\u5217\u306b\u306f\u4f55\u3082\u30c7\u30fc\u30bf\u304c\u5165\u3063\u3066\u3044\u306a\u3044\u5834\u5408\u306f\u30011000\u884c\u76ee\u304c\u6700\u7d42\u884c\u3068\u3068\u3057\u3066\u53d6\u5f97<\/strong><\/span>\u3055\u308c\u307e\u3059\u3002<br>\u3053\u306e\u6319\u52d5\u3082Ctrl + \u2193\u30ad\u30fc\u3092\u62bc\u4e0b\u3057\u305f\u3068\u304d\u3068\u540c\u3058\u3067\u3059\u306d\u3002<\/p>\n\n\n\n<p>\u3082\u3057\u3001A\u5217\u306e\u30c7\u30fc\u30bf\u306b\u9014\u4e2d\u306e\u884c\u3067\u7a7a\u6b04\u30bb\u30eb\u304c\u542b\u307e\u308c\u3066\u3044\u308b\u5834\u5408\u306f\u6700\u7d42\u884c\u307e\u3067\u3046\u307e\u304f\u30b8\u30e3\u30f3\u30d7\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u305b\u3093\u306e\u3067\u3001\u305d\u306e\u5834\u5408\u306fgetMaxRows\u3068\u7d44\u307f\u5408\u308f\u305b\u3066\u4e0b\u304b\u3089\u4e0a\u306b\u30c7\u30fc\u30bf\u304c\u5165\u3063\u3066\u3044\u308b\u30bb\u30eb\u3092\u53d6\u5f97\u3057\u305f\u3089\u826f\u3044\u304b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-js\" data-file=\"\u30b7\u30fc\u30c8\u6700\u7d42\u884c\u304b\u3089\u4e0a\u306b\u30c7\u30fc\u30bf\u304c\u5165\u3063\u3066\u3044\u308b\u30bb\u30eb\u3092\u53d6\u5f97\u3059\u308b\" data-lang=\"JavaScript\"><code>\/\/\u4e0b\u304b\u3089\u4e0a\u306b\u30c7\u30fc\u30bf\u304c\u5165\u3063\u3066\u3044\u308b\u6700\u7d42\u884c\u3092\u53d6\u5f97\u3059\u308b\nfunction sampleCodeForGetRowUpwards() {\n  let sheet = SpreadsheetApp.getActiveSheet();\n  let maxRow = sheet.getMaxRows();\n  let lastRow = sheet.getRange(maxRow, 1).getNextDataCell(SpreadsheetApp.Direction.UP).getRowIndex();\n  let msg = &quot;getRowUpwards\u3067\u53d6\u5f97\u3057\u305f\u6700\u7d42\u884c\uff1a&quot; + lastRow + &quot; \u884c&quot;;\n  showDialog(msg);\n}<\/code><\/pre><\/div>\n\n\n\n<figure class=\"wp-block-image size-large\"><img width=\"954\" height=\"920\" src=\"https:\/\/i0.wp.com\/for-dummies.net\/gas-noobs\/wp-content\/uploads\/2021\/06\/Direction_UP.png?resize=954%2C920&#038;ssl=1\" alt=\"Direction_Up\" class=\"wp-image-2535\" srcset=\"https:\/\/i0.wp.com\/for-dummies.net\/gas-noobs\/wp-content\/uploads\/2021\/06\/Direction_UP.png?w=954&amp;ssl=1 954w, https:\/\/i0.wp.com\/for-dummies.net\/gas-noobs\/wp-content\/uploads\/2021\/06\/Direction_UP.png?resize=300%2C289&amp;ssl=1 300w, https:\/\/i0.wp.com\/for-dummies.net\/gas-noobs\/wp-content\/uploads\/2021\/06\/Direction_UP.png?resize=768%2C741&amp;ssl=1 768w, https:\/\/i0.wp.com\/for-dummies.net\/gas-noobs\/wp-content\/uploads\/2021\/06\/Direction_UP.png?resize=222%2C214&amp;ssl=1 222w, https:\/\/i0.wp.com\/for-dummies.net\/gas-noobs\/wp-content\/uploads\/2021\/06\/Direction_UP.png?resize=270%2C260&amp;ssl=1 270w\" sizes=\"(max-width: 954px) 100vw, 954px\" data-recalc-dims=\"1\" \/><\/figure>\n\n\n\n<p>\u3053\u306e\u3088\u3046\u306b\u3001\u81ea\u5206\u304c\u53d6\u5f97\u3057\u305f\u3044\u30bb\u30eb\u306b\u79fb\u52d5\u3059\u308b\u65b9\u6cd5\u3092\u899a\u3048\u3066\u304a\u304f\u3068\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u7d44\u3080\u969b\u306e\u5f15\u304d\u51fa\u3057\u304c\u5897\u3048\u3066\u304f\u308b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<h3>\u2463 length<\/h3>\n\n\n\n<p>\u3053\u308c\u306f\u3001getDataRange\u95a2\u6570\u3068getValues\u95a2\u6570\u3068\u4f75\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u5165\u529b\u3055\u308c\u3066\u3044\u308b<span class=\"swl-marker mark_orange\"><strong>\u30c7\u30fc\u30bf\u3092\u4e8c\u6b21\u5143\u914d\u5217\u3067\u53d6\u308a\u51fa\u3057\u3066\u914d\u5217\u306e\u9577\u3055\u3092\u53d6\u5f97\u3059\u308b\u3053\u3068\u3067\u6700\u7d42\u884c\u3092\u53d6\u5f97<\/strong><\/span>\u3059\u308b\u65b9\u6cd5\u3067\u3059\u3002<br>getDataRange\u3067\u306f\u3001\u30c7\u30fc\u30bf\uff08\u5024\u3068\u6570\u5f0f\uff09\u304c\u5165\u3063\u3066\u3044\u308b\u30bb\u30eb\u3092\u5168\u90e8\u53d6\u5f97\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u3053\u306e\u72b6\u614b\u3067\u3001getValues\u95a2\u6570\u3092\u4f7f\u3046\u3053\u3068\u3067\u3001\u7bc4\u56f2\u5185\u306e\u3059\u3079\u3066\u306e\u5024\u304c\u4e8c\u6b21\u5143\u914d\u5217\u3068\u3057\u3066\u53d6\u5f97\u3067\u304d\u307e\u3059\u3002\u3053\u306e\u914d\u5217\u306e\u9577\u3055 = \u6700\u7d42\u884c\u3068\u3044\u3046\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<br>\u6570\u5f0f\u304c\u5165\u3063\u3066\u3044\u308c\u3070\u51fa\u529b\u7d50\u679c\u304c\u7a7a\u3063\u307d\u3060\u3068\u3057\u3066\u3082\u53d6\u5f97\u3055\u308c\u307e\u3059\u306e\u3067\u3001\u52d5\u4f5c\u3068\u3057\u3066\u306fgetLastRow\u95a2\u6570\u3092\u4f7f\u3063\u305f\u5834\u5408\u3068\u8fd1\u3044\u30a4\u30e1\u30fc\u30b8\u3060\u3068\u601d\u3044\u307e\u3059\u3002\u306a\u306e\u3067\u3001\u5148\u7a0b\u306e\u307e\u3068\u3081\u8868\u3067\u3082\u7d50\u679c\u304c\u540c\u3058\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u306d\u3002<\/p>\n\n\n\n<h2>\u6700\u7d42\u884c\u3092\u53d6\u5f97\u3059\u308b\u30dd\u30a4\u30f3\u30c8<\/h2>\n\n\n\n<p>\u4eca\u56de\u3001\u8272\u3005\u306a\u3084\u308a\u65b9\u3067\u6700\u7d42\u884c\u3092\u53d6\u5f97\u3059\u308b\u65b9\u6cd5\u3092\u5b66\u3093\u3067\u304d\u307e\u3057\u305f\u304c\u3001\u30ad\u30fc\u30dd\u30a4\u30f3\u30c8\u306f<\/p>\n\n\n\n<p class=\"is-style-big_icon_check\"><strong><span class=\"swl-marker mark_green\">\u30b7\u30fc\u30c8\u306b<\/span><\/strong><span class=\"swl-marker mark_green\"><strong>\u6570\u5f0f\u304c\u5165\u3063\u3066\u3044\u308b\u304b\u3069\u3046\u304b<\/strong><\/span><\/p>\n\n\n\n<p>\u6570\u5f0f\u304c\u5927\u91cf\u306b\u5165\u3063\u3066\u3044\u308b\u30b7\u30fc\u30c8\u3067\u3082\u3001\u5b9f\u969b\u306b\u307b\u3057\u3044\u30c7\u30fc\u30bf\uff08\u5024\u304c\u51fa\u529b\u3055\u308c\u3066\u3044\u308b\u884c\uff09\u306f\u5c11\u3057\u3057\u304b\u5165\u3063\u3066\u3044\u306a\u3044\u3068\u3044\u3046\u3088\u3046\u306a\u51e6\u7406\u306e\u5834\u5408\u3001<span class=\"swl-marker mark_orange\"><strong>\u5fc5\u8981\u306e\u306a\u3044\u30bb\u30eb\u306e\u30c7\u30fc\u30bf\u306f\u53d6\u5f97\u3057\u306a\u3044\u307b\u3046\u304c\u51e6\u7406\u306e\u9ad8\u901f\u5316\u306b\u7e4b\u304c\u308a\u307e\u3059<\/strong><\/span>\u3002<\/p>\n\n\n\n<p class=\"is-style-icon_announce\"><span class=\"swl-marker mark_orange\"><strong>\u77ed\u7d61\u7684\u306bgetLastRow\u306a\u3069\u3067\u6700\u7d42\u884c\u3092\u53d6\u5f97\u3057\u306a\u3044\u65b9\u304c\u826f\u3044\u5834\u5408\u304c\u3042\u308b<\/strong><\/span><\/p>\n\n\n\n<p><br>\u3068\u3044\u3046\u3053\u3068\u306f\u899a\u3048\u3066\u304a\u3044\u3066\u640d\u306f\u306a\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<h2>\u307e\u3068\u3081<\/h2>\n\n\n\n<p>Google Apps Script\u3092\u4f7f\u3063\u3066\u3044\u308b\u4eba\u306b\u306f\u3001\u52d5\u7684\u306b\u30b7\u30fc\u30c8\u306e\u6700\u7d42\u884c\u3092\u53d6\u5f97\u3057\u305f\u3044\u3068\u3044\u3046\u5834\u9762\u304c\u3088\u304f\u51fa\u3066\u304f\u308b\u3068\u601d\u3044\u307e\u3059\u304c\u3001\u30de\u30cb\u30e5\u30a2\u30eb\u904b\u7528\u3057\u3066\u3044\u308b\u3088\u3046\u306a\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8\u3068GAS\u3092\u5171\u5b58\u3055\u305b\u3088\u3046\u3068\u3059\u308b\u3068\u4eca\u56de\u306e\u8a18\u4e8b\u306e\u3088\u3046\u306b\u95a2\u6570\u304c\u5165\u3063\u3066\u3044\u308b\u305f\u3081\u306b\u300e\u6700\u7d42\u884c\u304c\u601d\u3063\u305f\u3068\u304a\u308a\u53d6\u5f97\u3067\u304d\u306a\u3044\uff01\u300f\u3068\u3044\u3046\u3088\u3046\u306a\u3053\u3068\u304c\u3042\u308b\u3068\u601d\u3044\u307e\u3059\u3002<br>\u305d\u306e\u969b\u306b\u3082GAS\u306e\u7279\u6027\u3084\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8\u306e\u7279\u6027\u3092\u7406\u89e3\u3057\u3001\u81ea\u5206\u306e\u5f15\u304d\u51fa\u3057\u3092\u5897\u3084\u3057\u3066\u304a\u304f\u3053\u3068\u3067\u4e0a\u624b\u306b\u51e6\u7406\u3092\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3053\u3068\u3082\u5c11\u306a\u304f\u3042\u308a\u307e\u305b\u3093\u3002<br>\u4eca\u56de\u3054\u7d39\u4ecb\u3057\u305f\u65b9\u6cd5\u306fGAS\u3067\u3067\u304d\u308b\u3053\u3068\u306e\u3059\u3079\u3066\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u306e\u3067\u3001\u305d\u306e\u4ed6\u306e\u65b9\u6cd5\u3082\u3042\u308b\u304b\u3068\u306f\u601d\u3044\u307e\u3059\u304c\u3001\u4f8b\u3068\u3057\u3066\u3044\u304f\u3064\u304b\u306e\u65b9\u6cd5\u3092\u3054\u7d39\u4ecb\u3057\u307e\u3057\u305f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4eca\u56de\u306fGoogle Apps Script\u3092\u4f7f\u3063\u3066\u6700\u7d42\u884c\u3092\u53d6\u5f97\u3059\u308b\u65b9\u6cd5\u3092\u3044\u304f\u3064\u304b\u304a\u4f1d\u3048\u3057\u307e\u3059\u3002\u6700\u7d42\u884c\u3092\u53d6\u5f97\u3059\u308b\u65b9\u6cd5\u306f\u8907\u6570\u3042\u308a\u307e\u3059\u304c\u3001\u4f7f\u7528\u3059\u308b\u72b6\u6cc1\u306b\u3088\u3063\u3066\u9069\u3057\u305f\u30e1\u30bd\u30c3\u30c9\u304c\u7570\u306a\u308a\u307e\u3059\u306e\u3067\u3001\u3069\u306e\u3088\u3046\u306a\u5834\u5408\u306b\u4f7f\u3046\u3079\u304d\u306a\u306e\u304b\u3068\u3044\u3046 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":2537,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"swell_btn_cv_data":"{\"ca5afbe1\":{\"pv\":45122,\"imp\":26528,\"click\":177},\"d5f9cabd\":{\"pv\":45122,\"imp\":34751,\"click\":403}}","spay_email":"","jetpack_publicize_message":"GAS\u3067\u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8\u304b\u3089\u6700\u7d42\u884c\u3092\u53d6\u5f97\u3044\u304f\u3064\u304b\u306e\u65b9\u6cd5\u3092\u8a18\u4e8b\u306b\u3057\u3066\u307f\u307e\u3057\u305f\u3002\n\u95a2\u6570\u306b\u3088\u3063\u3066\u5909\u308f\u308b\u6319\u52d5\u306a\u3069\u3082\u4f53\u9a13\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u3066\u3044\u307e\u3059\u306e\u3067\u3001\u78ba\u8a8d\u3057\u3066\u307f\u3066\u4e0b\u3055\u3044\u3002\n\n#GoogleAppsScript #GAS #\u6700\u7d42\u884c\u3092\u53d6\u5f97\u3059\u308b #SpreadsheetApp","jetpack_is_tweetstorm":false},"categories":[80,15,81],"tags":[51,191,192,52,91,65,113,193],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/for-dummies.net\/gas-noobs\/wp-content\/uploads\/2021\/06\/how_to_get_last_row_from_sheets.png?fit=320%2C180&ssl=1","jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p9Z92k-EN","jetpack_likes_enabled":true,"amp_validity":null,"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/for-dummies.net\/gas-noobs\/wp-json\/wp\/v2\/posts\/2529"}],"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\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/for-dummies.net\/gas-noobs\/wp-json\/wp\/v2\/comments?post=2529"}],"version-history":[{"count":13,"href":"https:\/\/for-dummies.net\/gas-noobs\/wp-json\/wp\/v2\/posts\/2529\/revisions"}],"predecessor-version":[{"id":2813,"href":"https:\/\/for-dummies.net\/gas-noobs\/wp-json\/wp\/v2\/posts\/2529\/revisions\/2813"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/for-dummies.net\/gas-noobs\/wp-json\/wp\/v2\/media\/2537"}],"wp:attachment":[{"href":"https:\/\/for-dummies.net\/gas-noobs\/wp-json\/wp\/v2\/media?parent=2529"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/for-dummies.net\/gas-noobs\/wp-json\/wp\/v2\/categories?post=2529"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/for-dummies.net\/gas-noobs\/wp-json\/wp\/v2\/tags?post=2529"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}