有什么方法可以通过在 NodeJS 中使用 ExcelJs 根据字体颜色找到 excel 中单元格的值

Is there any way to find the value of a cell in excel depending on the font colour by Using ExcelJs in NodeJS

有没有办法通过在 NodeJS 中使用 ExcelsJs 根据字体颜色找到 excel 中单元格的值

对于 示例, 我想获取 excel 中的所有值,它们的颜色字体为灰色

我使用的是 Nodejs,带有 exceljs 如有指教,将不胜感激 这张照片来自 sheet 我需要找到解决方案

他们似乎没有特殊的方法来搜索特定单元格和不同的标准,但您可以通过像这样迭代所有单元格来自己完成:

const rows = worksheet.getRows(1, worksheet.rowCount)

const foundCells = []
for (const row of rows) {
  const cells = row.
  for (let cIndex = 1; cIndex <= worksheet.columnCount; cIndex++) {
    const cell = row.getCell(cIndex);
    if (cell.font.bold) {
      foundCells.push(cell);
    }
  }
}