2017-06-10 13 views
0
//create a copy for next week below in cell A31 
function createWeek(){ 
var ss = SpreadsheetApp.getActiveSpreadsheet(); 
var source = ss.getRange ("Sheet1!A4:AN30"); 
source.copyTo (ss.getRange("Sheet1!A31")); 

var numRows = SpreadsheetApp.getActiveSpreadsheet().getLastRow() + 1; 
} 

次の空の行(この場合は31行目)に範囲をコピーしたいと思いますが、この行を変数にするためには毎週やりたいです来週は行が変わるからです。私は行(numRows)をカウントすることができますが、行の変更(Sheet1!A ???)を考慮に入れるように宛先の範囲を変更する方法がわかりません。感謝!!GoogleSheetの変数の範囲

+0

「ss.getRange( "Sheet1!A" + numRows) 'を実行できませんか? –

答えて

0

使用.getLastRow() + 1.getLastRow()は、データを含む最後の行を返します。次に+1して、空の次の行を取得します。