下面是我当前的脚本,这将转到第三列,并将该列中的第一行发布到不和谐的位置,这是一个很好的开始...但我需要发布整个列 - 第三列,第 1-42 行。
请有人帮忙提供正确的脚本,因为我现在迷路了:)
function postToDiscord(currentMessage) {
const url = "webhook"
const message = {
content: currentMessage
}
const options = {
'method' : 'post',
'payload' : message
}
const res = UrlFetchApp.fetch(url,options)
}
function mondaywtr(){
const ss = SpreadsheetApp.getActiveSpreadsheet()
const ws = ss.getSheetByName("Who To Raid 2.0")
const messageCell = ws.getRange(ws.getMaxColumns(),3).getNextDataCell(SpreadsheetApp.Direction.UP)
const currentMessage = messageCell.getValue()
postToDiscord(currentMessage)
}
这是我推荐的:
function mondaywtr(){
const ss = SpreadsheetApp.getActiveSpreadsheet()
const ws = ss.getSheetByName("Who To Raid 2.0")
// The number of rows of data
const rows = ws.getDataRange().getNumRows()
// Get the third column as a range
const range = sheet.getRange(1, 3, rows)
// Turn the range into an array
var values = range.getValues()
// Post each value in array to Discord
for (let i = 0; i < values.length; i++){
postToDiscord(values[i])
}
}