in reply to Need help with inserting images to excel from db

Spreadsheet::WriteExcel actually expects a filename to be passed to ->insert_image(), not raw image data. The following, fairly minimal example works for me:

#!/usr/bin/perl use strict; use warnings; use Spreadsheet::WriteExcel; my $workbook = Spreadsheet::WriteExcel->new("Employees.xls"); my $worksheet = $workbook->add_worksheet("Summary"); $worksheet->insert_image('A1', 'Lenna.png'); $workbook->close();

Since you're pulling the image from a database, you may have to write it to a temporary file. That, or bug the module's author to add a function that takes image data and inserts it directly into the spreadsheet.

Replies are listed 'Best First'.
Re^2: Need help with inserting images to excel from db
by terrykhatri (Acolyte) on Jul 08, 2014 at 09:54 UTC
    Thanks !! an expert Monk named Poj helped me solve it.