0

I need to write in a .xlsx file about 111.100 rows, using fromArray() but I have a strange error

I use phpspreadsheet library

        $spreadsheet = new Spreadsheet();
        $sheet = $spreadsheet->getActiveSheet();
        $columnLetter = 'A';
        foreach ($columnNames as $columnName) {
            // Allow to access AA column if needed and more
            $sheet->setCellValue($columnLetter.'1', $columnName);
            $columnLetter++;
        }
        $i = 2; // Beginning row for active sheet
        $columnLetter = 'A';
        foreach ($columnValues as $columnValue) {
            $sheet->fromArray(array_values($columnValue), NULL, $columnLetter.$i);
            $i++;
            $columnLetter++;
        }
        // Create your Office 2007 Excel (XLSX Format)
        $writer = new Xlsx($spreadsheet);

        // In this case, we want to write the file in the public directory
        // e.g /var/www/project/public/my_first_excel_symfony4.xlsx
        $excelFilepath =  $directory . '/'.$filename.'.xlsx';

        // Create the file
        $writer->save($excelFilepath);     

And I get the exception :

message: "Invalid cell coordinate AAAA18272"

#code: 0 #file: "./vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/Coordinate.php"

Can you help me please ?

HareaCostea
  • 145
  • 9

1 Answers1

0

Excel pages are limited. The limit is huge but still limited. This is a correct filter so you can't write if there is no space for it. Anyway you shouldnt use excel pages for such a big amount of data, you can try fragmenting it into smaller pieces, but databases should be the way to manipulate such amount of information

Mbotet
  • 170
  • 2
  • 17