美文网首页
php-read-excel

php-read-excel

作者: robertzhai | 来源:发表于2022-12-11 18:30 被阅读0次
<?php
ini_set('memory_limit',-1); //没有内存限制

require_once dirname(__FILE__) . '/PHPExcel-1.8/Classes/PHPExcel.php';

$excel_file = dirname(__FILE__) . '/yzc.xlsx';

$input_file_type = PHPExcel_IOFactory::identify($excel_file);
$obj_reader = PHPExcel_IOFactory::createReader($input_file_type);
$obj_php_excel = $obj_reader->load($excel_file);
$sheet = $obj_php_excel->getSheet(0);
$highest_row = $sheet->getHighestRow();
$highest_column = $sheet->getHighestColumn();
var_dump($highest_row, $highest_column);
// 获取一行的数据
$data = [];
for ($row = 2; $row <= $highest_row; $row++){
// Read a row of data into an array
    $row_data = $sheet->rangeToArray('A' . $row . ':' . $highest_column . $row, NULL, TRUE, FALSE);
    // 
}

相关文章

  • php-read-excel

    https://github.com/PHPOffice/PHPExcel/[https://github.com...

网友评论

      本文标题:php-read-excel

      本文链接:https://www.haomeiwen.com/subject/lvnfqdtx.html