| Googleを追いかけろ! |
| |
| . | ||
| home >> スプレッドシートのExercise(読み取り)-1 | ||
|
| * 範囲の最上段左端のインデックスを取得する・・getInde1() :
ここで利用する主なメソッド;getRange(),getRowIndex(),getColumnIndex()
| |
function getIndex1(){
// B3:D7に範囲を設定
// 最上段の行インデックス"4",左端列のインデックス"2"を取得
var index = SpreadsheetApp.getActiveSheet().getRange(3, 2, 5, 3 );
index.setBackground("gray");
indexr = index.getRowIndex();
indexc = index.getColumnIndex();
Browser.msgBox("最上段の行インデックスは" + indexr + ";" + "左端列のインデックスは" + indexc);
}
| |
| * 範囲の最上段左端のインデックスを取得する・・getIndex2() :
ここで利用する主なメソッド;getRange(),getRowIndex(),getColumnIndex()
| |
function getIndex2(){
// A1:D6に範囲を設定
// 最上段の行インデックス"1",左端列のインデックス"1"を取得
var index = SpreadsheetApp.getActiveSheet().getRange(1, 1, 6, 4 );
index.setBackground("gray");
indexr = index.getRowIndex();
indexc = index.getColumnIndex();
Browser.msgBox("最上段の行インデックスは" + indexr + ";" + "左端列のインデックスは" + indexc);
}
| |
| * 範囲のデータすべてを取得する・・getAllData() :
ここで利用する主なメソッド;getDataRange(),getValues()
| |
function getAllData(){
// A1:D6範囲内のデータをすべて取得
var range = SpreadsheetApp.getActiveSheet().getDataRange();
Browser.msgBox(range.getValues());
}
| |
| * アクティブ範囲の最上段左端のデータを取得する・・getValue() :
ここで利用する主なメソッド;getValue()
| |
function getValue(){
//アクティブ範囲の値の取得
var value = SpreadsheetApp.getActiveRange().getValue();
Browser.msgBox(value);
}
| |