getActiveSheet(); // Open the CSV file $file = fopen($csvFilePath, 'r'); if (!$file) { throw new \Exception("Cannot open CSV file."); } $rowIndex = 1; // Read each row and add it to the spreadsheet while (($row = fgetcsv($file, 0, $delimiter)) !== false) { $colIndex = 'A'; foreach ($row as $cell) { // Veriyi hücreye yaz // if($cell == "NULL") $cell = ""; $sheet->setCellValue($colIndex . $rowIndex, $cell); $colIndex++; } $rowIndex++; } fclose($file); // Write to XLSX file $writer = IOFactory::createWriter($spreadsheet, 'Xlsx'); $writer->save($outputFilePath); return $outputFilePath; } catch (\Exception $e) { $result = []; $result['error'] = "Error: " . $e->getMessage(); return $result; } } ?>