GASのスプレッドシートを触る
from GASを試す
Google Apps Scriptでスプレッドシートを触る
ドキュメント:https://developers.google.com/apps-script/reference/spreadsheet
Google Apps Script で Spreadsheet にアクセスする方法まとめ - Qiita
またしても権限を渡す必要がある(関数を実行するとダイアログが出るので従う)
https://gyazo.com/6159997cdd2cfd25a13531fa3ba2c741
セルのデータ取得
参考
【GoogleAppsScript】スプレッドシート操作(セルデータの取得偏) - Qiita
【Google Apps Script入門】セルの取得・変更をする | UX MILK
スプレッドシートが
https://gyazo.com/6398fce4a1dfd77a3240dc00de882a65
とすると、
code:myfunction.js
const spreadSheet = SpreadsheetApp.openById('YOUR_ID');
const sheet = spreadSheet.getSheetByName('your_sheet');
Logger.log(sheet.getDataRange().getValues());
で表示されるログはこう
code:_
19-11-16 10:42:45:239 PST 1.0, 2.0, 3.0], 4.0, 5.0, 6.0, [6.0, 7.0, 8.0
条件式
https://developers.google.com/apps-script/reference/spreadsheet/boolean-condition.html#getCriteriaType()
Extending Google Sheets  |  Apps Script  |  Google Developers
README的なやつ
シートに対してスクリプトを作用させるためには2つの方法がある
scriptに権限を与える
今回はこっちをやった
シートに対してbound scriptを使う
Spreadsheet serviceを使うと2次元配列としてsheetを利用することができる
To retrieve the data from the spreadsheet, you must get access to the spreadsheet where the data is stored, get the range in the spreadsheet that holds the data, and then get the values of the cells. Apps Script facilitates access to the data by reading structured data in the spreadsheet and creating JavaScript objects for them.
書き込み方法
フォーマットの変更
バリデーション
チャート
custom function
セルの時刻操作
Spreadsheetでの日付と、Google Apps ScriptでのnewDate()
参考になりそうな資料
【GoogleAppsScript】スプレッドシート操作(セルへのデータ書き込み偏) - Qiita
ハマり
列方向の捜査ができない
全部データを取得してしまってメモリ上で転置させるなどの工夫が必要
GASは手軽にnpmが使えないのでこのあたりの処理を真面目にやろうとするとダルそう