如何在 express js 中将图片插入 excel 单元格

How I can insert picture into excel cell in express js

我正在做一个项目,我需要将图片插入到 excel 单元格中。我发现许多节点包允许我们将图片插入 excel,但找不到将图片插入 excel 单元格的包。

现在我正在使用 xlsx 包,将 JSON 数据转换为 excel sheet

const XLSX = require('xlsx');

let data = {name: 'Rizwan', age: 25}
const workSheet = XLSX.utils.json_to_sheet(data);
const workBook = XLSX.utils.book_new();

XLSX.utils.book_append_sheet(workBook, workSheet, 'students');
// Generate buffer
XLSX.write(workBook, { bookType: 'xlsx', type: 'buffer' });

// Binary string
XLSX.write(workBook, { bookType: 'xlsx', type: 'binary' });

XLSX.writeFile(workBook, search_term + '.xlsx');

有很多节点包,可以用来插入图片到excel sheet像exceljs, excel4node, or excellent. But, my requirement was to insert picture into the cell of the excel sheet. libxl包可以用来插入图片到excel细胞.