Phpexcel Import xlsx File error xlsx is not recognised as OLE file

Source: Internet
Author: User
Tags mongodb ole postgresql redis


The initial approach


The code is as follows



Include ' classes/phpexcel/iofactory.php ';

$inputFileName = $target;


$objReader = new Phpexcel_reader_excel5 ();

$objPHPExcel = $objReader->load ($inputFileName);
$sheetData = $objPHPExcel->getactivesheet ()->toarray (null,true,true,true);
$count = count ($sheetData);
for ($i =1; $i <= $count; $i + +)
{
Echo (iconv ' utf-8 ', ' GBK ', $sheetData [$i] [' A ']). ' }


Error



phpexcel_reader_exception:the filename. 1443578799.xlsx is not recognised as a OLE file in Classes\phpexcel\shared\olere Ad.php on line 89



( ! ) Fatal error:uncaught exception ' phpexcel_reader_exception ' with message ' "The filename 1443578799.xlsx is not recognised a S ' OLE file ' in classes\phpexcel\shared\oleread.php on line 89
( ! ) phpexcel_reader_exception:the filename 1443578799.xlsx is not recognised as a OLE file in Classes\phpexcel\shared\olerea D.php on line 89
Call Stack



We encountered this problem because of xlsx error, may be through the type of the resolution of the following


The code is as follows



if ($extension = = ' xlsx ')
{
$objReader = new phpexcel_reader_excel2007 ();
}
Else
{
$objReader = new Phpexcel_reader_excel5 ();
}


This will find that the problem has been solved.


Alibaba Cloud Hot Products

Elastic Compute Service (ECS) Dedicated Host (DDH) ApsaraDB RDS for MySQL (RDS) ApsaraDB for PolarDB(PolarDB) AnalyticDB for PostgreSQL (ADB for PG)
AnalyticDB for MySQL(ADB for MySQL) Data Transmission Service (DTS) Server Load Balancer (SLB) Global Accelerator (GA) Cloud Enterprise Network (CEN)
Object Storage Service (OSS) Content Delivery Network (CDN) Short Message Service (SMS) Container Service for Kubernetes (ACK) Data Lake Analytics (DLA)

ApsaraDB for Redis (Redis)

ApsaraDB for MongoDB (MongoDB) NAT Gateway VPN Gateway Cloud Firewall
Anti-DDoS Web Application Firewall (WAF) Log Service DataWorks MaxCompute
Elastic MapReduce (EMR) Elasticsearch

Alibaba Cloud Free Trail

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.