Skip to content

[BUG] Inline image is not parsed #2855

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
liudonghua123 opened this issue Dec 4, 2024 · 2 comments
Open

[BUG] Inline image is not parsed #2855

liudonghua123 opened this issue Dec 4, 2024 · 2 comments

Comments

@liudonghua123
Copy link

🐛 Bug Report

I tried to use this package to parse data.xlsx and want to get the inline image, but it failed.

Lib version: 4.4.0

Steps To Reproduce

import ExcelJS  from 'exceljs';
const { Workbook } = ExcelJS ;
const workbook = new Workbook();
const data = await workbook.xlsx.readFile('data.xlsx');

const worksheet = workbook.worksheets[0];
for (const image of worksheet.getImages()) {
  console.log('processing image row', image.range.tl.nativeRow, 'col', image.range.tl.nativeCol, 'imageId', image.imageId);
  // fetch the media item with the data (it seems the imageId matches up with m.index?)
  const img = workbook.model.media.find(m => m.index === image.imageId);
  console.log('found image for imageId', image.imageId, 'extension', img.extension);
  // fs.writeFileSync(`${image.range.tl.nativeRow}.${image.range.tl.nativeCol}.${img.name}.${img.extension}`, img.buffer);
}

The expected behaviour:

worksheet.getImages() should returns the inline images.

Possible solution (optional, but very helpful):

  1. worksheet.getImages() returns the inline images.
  2. worksheet.getCell('C2') returns the image data.

data.xlsx

@rduque1
Copy link

rduque1 commented Apr 8, 2025

Same for me, it's doesn't work

@leviv
Copy link

leviv commented May 9, 2025

+1 doesn't work when creating an excel file in MS excel, but works for files created in Google sheets

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants