When TP5 uses phpspreadsheet, if the number of columns exceeds 26, it will report an error. The specific solutions are as follows: it is easy to use by personal test
//Write to the table header section to read
// Set the table header
// $head formatted as ['Name', 'Phone', 'Contact']
$colum = 'A';
foreach ($head as $v) {
$sheet->setCellValue($colum . '1', $v);
$sheet->getColumnDimension($colum)->setWidth(20);
$colum++;
}
//Write content to read
$column = 2;
foreach ($data as $key => $rows) {
$span = 'A';
// Column Write
foreach ($rows as $keyName => $value) {
$sheet->setCellValue($span . $column, $value);
$span++;
}
$column++;
}
Read More:
- How to Solve phpExcel Error: ERR_INVALID_RESPONSE
- Hyperf [ERROR] Invalid protocol of registry consul[205]
- TP5 fuzzy Chinese characters error [How to Solve]
- PHP: How to get the total number of data in the MySQL table (total number of rows)
- [Solved] has been blocked by CORS policy: Response to preflight request doesn‘t pass access control check: No
- Laravel5.5 Error: SQLSTATE[42000] Syntax error or access violation 1071 Specified key was too long; max k
- HTML + PHP inline execute JavaScript Error [How to Solve]
- [Solved] PHP post Datas json_decode Error: 4 JSON_ERROR_SYNTAX
- PHP: How to parse MHT file into HTML
- ThinkPHP interface cross domain request error [Solved]
- [Solved] ‘node’ command failed to start the project, with an error: “unknown database’ mydb ‘”
- [Solved] Warning: Unknown: Failed to write session data using user defined save handler. (session.save_path:
- [PHP] Solve the 500 error problem-nginx and fpm have no error logs
- PHP error in Windows: class’ mysqli ‘not found
- PHP use __Sleep() and __wakeup() method serializes the object
- [Solved] Model Error: must return a relationship instance
- Undefined index: name error in composer [How to Solve]
- Unserialize(): cause analysis and solution of error at offset
- How to solve Magento 500 internal server errors
- [Solved] Fatal error: Uncaught Error: Class ‘Imagick‘ not found