[問題] google script 如何執行

看板Programming作者 (seft584f8)時間1年前 (2023/03/03 15:47), 1年前編輯推噓1(100)
留言1則, 1人參與, 7月前最新討論串1/1
最近嘗試寫google script(中文被翻成錄製巨集,奇怪的翻譯.. 但應該實際上是script editor ) 寫了一段code, 目標是針對一個cell作為一個按鈕, click該按鈕其對應的cell的數值減1 function myFun_onclick123123321321() { // Step 1: Get the position of the current cell (row, col) var sheet = SpreadsheetApp.getActiveSheet(); var cell = sheet.getActiveCell(); var row = cell.getRow(); var col = cell.getColumn(); // Step 2: Use VLOOKUP to get the value of the target cell in 料件表 var table2Sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("料件 表"); var lookupRange = table2Sheet.getRange("A:M"); var lookupValue = sheet.getRange(row + 4, col).getValue(); var columnIndex = 6; // You may need to adjust this depending on which column you want to look up var targetCell = SpreadsheetApp.functions.vlookup(lookupValue, lookupRange, columnIndex, false); // Step 3: If the value of the target cell in table2 is greater than 0, decrement it by 1 if (targetCell.getValue() > 0) { targetCell.setValue(targetCell.getValue() - 1); } } 我點執行嘗試看看是否有bug時, 出現一個視窗: 需要授權 我選審查驗證之後需要重新登入google帳號 登入後出現以下文字: 系統已封鎖這個應用程式 這個應用程式嘗試存取您 Google 帳戶中的機密資訊。為保護您的帳戶,Google 已阻擋 這個存取行為。 ( 我把code簡短到什麼都沒寫也會出現此訊息, 所以估計應該跟程式沒關係, 而是可能 需要某種權限 或者要升級商業模式? ) 請問大大知道怎麼讓google scrip寫好後可以使用嗎? -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 220.142.49.24 (臺灣) ※ 文章網址: https://www.ptt.cc/bbs/Programming/M.1677829668.A.B72.html ※ 編輯: seft584f8 (220.142.49.24 臺灣), 03/03/2023 15:48:26 ※ 編輯: seft584f8 (220.142.49.24 臺灣), 03/03/2023 15:49:24

09/22 22:22, 7月前 , 1F
問Bard,Google的東西問他最清楚
09/22 22:22, 1F
文章代碼(AID): #1a0QOajo (Programming)
文章代碼(AID): #1a0QOajo (Programming)