如何在 Google Sheets Apps 脚本中 return 来自多个单元格的数据?

How can I return data from more than one cell in Google Sheets Apps Script?

所以我目前正在使用 Google 表格作为我正在制作的费用跟踪器。

Here is an example

目前我可以通过这个功能显示100以上的费用;

function MORETHANONEHUNDRED(values)
{
  let myArray= [];
  for(let i =0; i<values.length; i++)
  {
    let num = parseInt(values[i]); 
    if(num>100)
    {
      myArray.push(num); 
    }
  }

  return "Here is your array " + myArray; 
}

但是,这只显示号码,而我还希望显示服装品牌。如果费用超过100,如何让费用和对应的服装品牌显示给用户?

谢谢!

如果您有兴趣在对话框中显示电子表格的当前选定范围:

function dispssdata() {
  const ss = SpreadsheetApp.getActive();
  const sh = ss.getActiveSheet();
  const rg = sh.getActiveRange();
  const vs = rg.getDisplayValues();
  let html = '<style>td{border:1px solid black;text-align:center;padding:1px 2px}</style><table>'
  vs.forEach((r,i) =>{
    html += '<tr>';
    r.forEach((c,j) => {
      html+= `<td>${c}</td>`
    });
    html += '</tr>'
  })
  html += '</table>'
  SpreadsheetApp.getUi().showModelessDialog(HtmlService.createHtmlOutput(html),'Display Active Range');
}

活动范围:

对话:

为了回答我的问题,以下代码行将允许我完成我想要的:

const MORETHANONEHUNDRED = v => v.filter(([a]) => a > 100);

感谢 的帮助。