我需要使用fromArray()在一个大约111.100行的.xlsx文件中编写代码,但是我遇到了一个奇怪的错误
我使用phpspreadsheet库
$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); 我得到了一个例外:
消息:“无效的单元坐标AAAA18272”
#代码:0#文件:"./vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Cell/Coordinate.php“
你能帮帮我吗?
发布于 2019-02-06 16:48:33
Excel页面有限。限制是巨大的,但仍然是有限的。这是一个正确的筛选器,因此如果没有空间,您将无法写入。无论如何,您不应该使用excel页面来处理如此大量的数据,您可以尝试将其分成较小的片段,但数据库应该是处理这些大量信息的方法。
https://stackoverflow.com/questions/54417948
复制相似问题