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
22
votes
4 answers

Formatting a cell to a percentage in PHPExcel

I am automating an excel spreadsheet using PHP. I have been looking for a way to pragmatically format a cell to a percentage in PHPExcel. I want to change a value like 0.077922078 to 8% Is there a solution for this? Thanks in advance.
cwiggo
  • 2,541
  • 9
  • 44
  • 87
22
votes
6 answers

How to export data to an excel file using PHPExcel

I have taken the source code from limesurvey and have added the PHPExcel library to my limesurvey code to export data to an excel file after you click a link. Currently the excel file opens with some dummy data in it with no problems. I need to be…
Bobby Ricky
  • 381
  • 2
  • 6
  • 14
21
votes
1 answer

phpexcel set data type on range of cells

With PHPExcel, I'm using: $workSheet->fromArray($array); To set my data. However, one column needs to be set as string (a number with a leading zero, the leading zero gets cut off if not set to string). If I wasn't using the fromArray method, I…
Ashley
  • 5,939
  • 9
  • 39
  • 82
21
votes
6 answers

Reading numbers as text format with PHPExcel

I have an array that can store numbers in such as 01, 01A, 01B, 02, 2, and When I get this value using PHPExcel, it's being removed the '0's in case of 01, 02, for example. To solve this problem, I tried to format the row where these values will be…
sergioviniciuss
  • 4,596
  • 3
  • 36
  • 50
20
votes
4 answers

How to set money format in PhpSpreadSheet?

I'm using PHPSpreadSheet and I want to set money format for a cell. In PHPExcel you can do this by using the following lines... $this->phpExcelObject->getActiveSheet() ->getStyle('D4') ->getNumberFormat() …
Brandon Asaph
  • 357
  • 1
  • 2
  • 12
20
votes
3 answers

Fatal error: 'break' not in the 'loop' or 'switch' context in Function.php

I am trying PHPExcel and I get an error in output when I perform my script: Fatal error: 'break' not in the 'loop' or 'switch' context in /opt/lampp/htdocs/Xlsphp/test/Classes/PHPExcel/Calculation/Functions.php on line 581 I don't know what I am…
user979974
  • 883
  • 3
  • 13
  • 32
20
votes
4 answers

PHPExcel download using ajax call

App::import('Vendor', 'PHPExcel/Classes/PHPExcel'); $objPHPExcel = new PHPExcel(); $objPHPExcel->getActiveSheet()->setTitle('ReceivedMessages'); header('Content-Type: application/vnd.ms-excel'); $file_name =…
Sadikhasan
  • 18,365
  • 21
  • 80
  • 122
20
votes
3 answers

PHPExcel - Incorrect data population during excel report generation

I am working on a project in Symfony 2.1.PHPExcel version is 1.8.0. I use Doctrine to retrieve the data from Db and filter if required. $em = $this->getDoctrine()->getManager(); $guardquery = $em->createQueryBuilder() …
Basher51
  • 1,319
  • 1
  • 17
  • 28
20
votes
5 answers

Read only specific sheet

I am trying to read just one sheet from an xls document and I have this: $objPHPExcel = $objReader->load('daily/' . $fisierInbound); $objWorksheet = $objPHPExcel->setActiveSheetIndex(0); foreach ($objPHPExcel->getWorksheetIterator() as $worksheet)…
ardb
  • 6,075
  • 5
  • 14
  • 16
20
votes
3 answers

PHPExcel How to get only 1 cell value?

I would think that a getCell($X, $y) or getCellValue($X, $y) would be available for one to easily pick a a certain value. This can be usefully, as example crosscheck data prior to a larger process. How do you get a specific value from say cell C3. I…
CrandellWS
  • 2,708
  • 5
  • 49
  • 111
20
votes
3 answers

Setting autosize column phpExcel

How do I make PHPExcel create the column width automatically I don't like having to go in by hand and stretch the columns witdth. I have looked at other examples but none work for me. Here is my…
Yamaha32088
  • 4,125
  • 9
  • 46
  • 97
20
votes
4 answers

PHPExcel set border and format for all sheets in spreadsheet

I'm currently trying to set all borders for my spreadsheet, also formatting such as autosize. My code below is working, for sheet 1. All other sheets inside the spreadsheet are completely untouched. I've been trying to get it to work with all other…
Tuzki
  • 493
  • 2
  • 11
  • 20
19
votes
2 answers

Reading a XLSX sheet to feed a MySQL table using PHPExcel

I found the PHPExcel library brilliant to manipulate Excel files with PHP (read, write, and so on). But nowhere in the documentation is explained how to read a XLSX worksheet to feed a MySQL table... Sorry for this silly question, but i need it for…
mlh
  • 584
  • 2
  • 6
  • 18
19
votes
3 answers

php_zip does not exist in php 5.3.5

I'm in the process of using PHPExcel. One of the requirements is that I need to enable php_zip. (...) if you need PHPExcel to handle .xlsx or .ods files you will need the zip extension... I'm using PHP v5.3.5. and in my php.ini file, I have the…
Steven
  • 19,224
  • 47
  • 152
  • 257
19
votes
1 answer

PHPExcel renaming default worksheet name to another name

I am using PHPExcel to export my files from database, but my problem is when I download my excel the name of my sheet is the default "Worksheet". I would like to set it to another name like "Hello world". Here's my code so far require_once…
user3796899
  • 191
  • 1
  • 1
  • 5