(1)首先從github上下載PHPExcel,
(2)拷貝到本地服務器運行的文件夾下
(3)載入PHPExcel類和IOFactory類
(4)讀取excel文件
(5)讀取行列對應的數值即可
<?php
require_once dirname(__FILE__) . '/Classes/PHPExcel.php';
require_once dirname(__FILE__) . '/Classes/PHPExcel/IOFactory.php';
$path = "./data.xlsx";
$fileType = PHPExcel_IOFactory::identify($path);
$objReader = PHPExcel_IOFactory::createReader($fileType);
$objPHPExcel = $objReader->load($path);
$currentSheet = $objPHPExcel->getSheet(0);
for ($i = 10; $i <= 17; $i++){
$result = (string) ($currentSheet->getCell('I'.$i)->getValue());
echo $result . "</br>";
}
參考文章鏈接
————————————————
版權聲明:本文爲CSDN博主「yangshuolll」的原創文章,遵循 CC 4.0 BY-SA 版權協議,轉載請附上原文出處鏈接及本聲明。
原文鏈接:https://blog.csdn.net/worldmakewayfordream/article/details/78556706