使用PHPExcel将xlsx文件转换为csv时,多个工作表之间的vlookup值不会拉到csv文件(显示为#REF!)。最常见的计算方法是一个问题,但不是vlookup。
有什么建议吗?这是我正在使用的代码:
include 'PHPExcel/IOFactory.php';
$objReader = PHPExcel_IOFactory::createReader($sread);
$objReader->setReadDataOnly(true);
$objPHPExcel = $objReader->load($fpath);
$loadedSheetNames = $objPHPExcel->getSheetNames();
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'CSV');
$objWriter->setDelimiter("|x3x3x3x|");
$objWriter->setEnclosure("\"");
$sloop = 1;
//SHEET LOOP
foreach($loadedSheetNames as $sheetIndex => $loadedSheetName) {
$tablex = $trackid."_".$sloop;
$objPHPExcel->setActiveSheetIndexByName($loadedSheetName);
$highestRow = $objPHPExcel->getActiveSheet()->getHighestRow();
$highestColumn = $objPHPExcel->getActiveSheet()->getHighestColumn();
$highestColumnIndex = PHPExcel_Cell::columnIndexFromString($highestColumn);
$objWriter->setSheetIndex($sheetIndex);
$objWriter->save("files/".$loadedSheetName.".csv");
//LOAD DATA INTO DB HERE
$sloop++;
} //END OF SHEET LOOP