Questions tagged [phpexcel]

A PHP library to create, read, edit and write spreadsheet files for MS Excel and other spreadsheet programs

PHPExcel was a library written in pure PHP that provides methods to read workbook files generated by Excel and other spreadsheet programs (Excel 95 and higher .xls and .xlsx, Excel 2003 XML, Comma-Separated Value, SYLK, Gnumeric, and Open/Libre Office Calc .ods); to manipulate spreadsheet data and formatting; and to create/write to various formats (Excel BIFF8 .xls, Excel 2007 .xlsx, Comma-Separated Value, HTML, and PDF).

It is a component of the PHPOffice suite of libraries, comprising PHPExcel, PHPWord, PHPPowerPoint, PHPProject and PHPVisio.

The last production release of PHPExcel was version 1.8.1 in year 2015 via composer and git.

The final notice from PHPExcel is:

The project has not be maintained for years and must not be used anymore. All users must migrate to its direct successor PhpSpreadsheet, or another alternative.

Popular questions

Resources

Documentation

3639 questions
19
votes
4 answers

PHPExcel lock particular cell

In phpexcel i was able to lock cell by $objPHPExcel->getActiveSheet()->protectCells('A1:D1', 'php'); $objPHPExcel->getActiveSheet()->getProtection()->setSheet(true); If i double click on any Cell between A1 to D1 it will ask for password as it…
sravis
  • 3,562
  • 6
  • 36
  • 73
19
votes
4 answers

Php Excel set whole column data alignment not working

I am Using this code For E column data set to right align but Its not showing me effect $objPHPExcel->getActiveSheet() ->getStyle('E') ->getAlignment() ->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT); instead of 'E' if i…
pankil thakkar
  • 411
  • 1
  • 5
  • 15
19
votes
3 answers

Looping through worksheets with PHPExcel

I'm using the PHPExcel library to read an Excel file and perform processing on it. I want to loop through each worksheet. I checked the documentation and all I could find was changing the active worksheet index or only loading specified…
user717236
  • 4,959
  • 19
  • 66
  • 102
18
votes
3 answers

PHP excel - data looping?

I have an array of arrays of data. so the basic format is $sheet = array( array( 'a1 data', 'b1 data', 'c1 data', 'd1 data', ), array( 'a2 data', 'b2 data', 'c2 data', 'd2 data', ), array( 'a3 data', …
Hailwood
  • 89,623
  • 107
  • 270
  • 423
18
votes
5 answers

Read Date Format in PHP EXCEL

I have read excel file using PHP excel . But that excel file contain some date (time format) PHP excel return wrong values for that case My code is in below enter code hereinclude 'Classes/PHPExcel/IOFactory.php'; $inputFileName =…
user5330699
18
votes
4 answers

PHPExcel - How to set a url

I am isung PHPExcel and have a URL in a string. When doing: $url = 'http://dx.doi.org/10.1016/j.phymed.2005.11.003' $xls = new PHPExcel(); $xls->setActiveSheetIndex(0); $xls->getActiveSheet()->setCellValueByColumnAndRow(1,2,$url); The url is set as…
Milos Cuculovic
  • 19,631
  • 51
  • 159
  • 265
18
votes
6 answers

Merging cells in Excel by rows and columns together using PHPExcel

I need to merge cells in Excel (xlsx) by rows and again by columns using PHPExcel. I tried the following. $sheet->mergeCells("G".($row_count+1).":G".($row_count+4)); $sheet->mergeCells("H".($row_count+1).":H".($row_count+4)); …
Tiny
  • 27,221
  • 105
  • 339
  • 599
18
votes
7 answers

"Excel found unreadable content" warning when opening Excel files made with PHPExcel

I'm trying to download Excel files (xlsx) using PHPExcel as follows. require_once("../../phpExcel/Classes/PHPExcel.php"); require_once("../../phpExcel/Classes/PHPExcel/IOFactory.php"); $objPHPExcel = new…
Tiny
  • 27,221
  • 105
  • 339
  • 599
17
votes
5 answers

PHP Excel Header

header("Content-Type: application/vnd.ms-excel; charset=utf-8"); header("Content-type: application/x-msexcel; charset=utf-8"); header("Content-Disposition: attachment; filename=abc.xsl"); header("Expires: 0"); header("Cache-Control:…
user794624
  • 367
  • 1
  • 5
  • 11
17
votes
5 answers

PHPExcel set border color of a cell

How to set border color of a cell? I used this code, but it's not working: $objPHPExcel->getActiveSheet() ->getStyle('A1') ->getBorders() ->getAllBorders() …
Muntashir Akon
  • 8,740
  • 2
  • 27
  • 38
16
votes
6 answers

How to use PHPExcel correctly with Symfony 2

I need to use PHPExcel with a Symfony2 project. Anyone know how to set up the project correctly to use the library? Should i put it in the vendor directory? What should be changed in the configuration files etc?
YakobeYak
  • 555
  • 2
  • 6
  • 17
16
votes
3 answers

Styling cell borders with PhpSpreadsheet PHP

I use PhpSpreadsheet to read o write in Excel files. I want to add to my excel a border style so I used this code:
dardar.moh
  • 5,987
  • 3
  • 24
  • 33
16
votes
1 answer

Prevent PHPExcel to calculate values when writing to file

When writing my data in an Excel file with class PHPExcel. This is happening when the writer works, not when adding data to the cells $this->sheet->setCellValue() Fatal error: Uncaught exception 'PHPExcel_Calculation_Exception' with message…
Perocat
  • 1,481
  • 7
  • 25
  • 48
16
votes
7 answers

PHPExcel ZipArchive not found

I've just downloaded PHPExcel package and I tried to import an Excel spreadsheet, but all I get is an error ZipArchive not found. I work on Windows, but server is on Linux. I checked php.ini to see if php_zip is disabled, but it wasn't even there. I…
whiteestee
  • 301
  • 1
  • 4
  • 12
16
votes
6 answers

Always display specified number of decimal places in Excel

I need to display two decimal places in Excel (xlsx). I'm using PHPExcel. In PHP, I can use something like the following to display only the specified number of decimal paces. echo sprintf("%0.2f", $row['price']); which always displays two decimal…
Tiny
  • 27,221
  • 105
  • 339
  • 599