Are there limitations or bugs in the ExcelWriter package that could be causing Excel files generated by PHP to have unreadable content errors?

The ExcelWriter package may have limitations or bugs that could be causing Excel files generated by PHP to have unreadable content errors. To solve this issue, you can try using an alternative package like PhpSpreadsheet, which is a more modern and actively maintained library for creating Excel files in PHP.

// Include PhpSpreadsheet library
require 'vendor/autoload.php';

use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;

// Create a new Spreadsheet object
$spreadsheet = new Spreadsheet();

// Add data to the spreadsheet
$sheet = $spreadsheet->getActiveSheet();
$sheet->setCellValue('A1', 'Hello');
$sheet->setCellValue('B1', 'World');

// Save the spreadsheet as an Excel file
$writer = new Xlsx($spreadsheet);
$writer->save('hello_world.xlsx');