node.jsexpressexport-to-excel

How I can insert picture into excel cell in express js


I am working on a project, where I need to insert picture into an excel cell. I found many node packages that allow us to insert picture into excel, but could not find a package to insert picture into an excel cell.

enter image description here

Right now I am using xlsx package, to convert JSON data into 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');

Solution

  • There are many node packages, that can be used to insert pictures into an excel sheet like exceljs, excel4node, or excellent. But, my requirement was to insert picture into the cell of the excel sheet. libxl package can be used to insert picture into the excel cell.