getActiveSheet(); $active_sheet->setCellValue('A1', "Name"); $active_sheet->setCellValue('B1', "Author"); $active_sheet->setCellValue('C1', "Magazine"); $row = 2; foreach ($data as $d) { $active_sheet->setCellValue('A' . $row, $d["name"]); $drawing = new Drawing(); $drawing->setName($d["name"]); $drawing->setPath("../imgs/" . $d["thumbnail"]); $drawing->setHeight(200); $comment = $active_sheet->getComment('A' . $row); $comment->setBackgroundImage($drawing); $comment->setSizeAsBackgroundImage(); $active_sheet->setCellValue('B' . $row, $d["author"]); $active_sheet->setCellValue('C' . $row, $d["magazine"]); $row++; } $writer = new Xlsx($spreadsheet); $writer->save('php://output'); $spreadsheet->disconnectWorksheets();