我是一個相對的新手。我在Google電子表格中有一長串費用清單,我希望它能夠在打開工作表時根據當前月份跳到此列表中的相應位置。每個月有200行,所以我想爲它做類似:根據今天的日期打開一個Google表格到特定的地方
= MONTH(TODAY())*200
但這並不腳本里面工作。我試圖從執行此功能的單元格拉它,但我不知道如何做到這一點。在下面的例子,我可以跳轉到九月,因爲我定義
var monthrow = 1800
但如何做到這一點的基礎上今天的日期幾個月的休息嗎?感謝您的幫助!
function onOpen() {
goToSheet2b()
}
function goToSheet2b() {
var monthrow = 1800
goToSheet("Expenses", monthrow, 2);
}
function goToSheet(sheetName, row, col) {
var sheet = SpreadsheetApp.getActive().getSheetByName(sheetName);
SpreadsheetApp.setActiveSheet(sheet);
var range = sheet.getRange(row, col)
SpreadsheetApp.setActiveRange(range);
不得不將其更改爲var monthrow =(month + 1)* 200;但除此之外,它的作品。謝謝! –
雖然在我的手機上打開工作表時不起作用!爲什麼會這樣? –
我很高興它爲你工作一點點調整(我假設Jan從第一行開始)。我不知道爲什麼它不適用於你的手機。也許與應用程序訪問表單的方式有關?我知道該應用程序的功能有限。如果您的問題已得到解答,請考慮接受答案作爲解決方案。 – mongoose36