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
30
votes
6 answers

Correct format for strings / numbers beginning with zero?

I'm trying to use PHP to create a file containing a list of phone numbers. It's working OK however if the phone number begins with zero, the digit is dropped from the Excel file. Does anyone know how to set the formatting correctly so that it…
Dan
  • 387
  • 2
  • 5
  • 8
29
votes
1 answer

PHPExcel modify existing .xlsx file with multiple worksheet

require_once '../Classes/PHPExcel/IOFactory.php'; /** PHPExcel */require_once '../Classes/PHPExcel.php'; $excel2 = PHPExcel_IOFactory::createReader('Excel2007'); $excel2 =…
Denish
  • 2,800
  • 2
  • 23
  • 33
29
votes
2 answers

What are the main differences between PHPExcel and PhpSpreadsheet?

In project of PHPOffice there are two projects associated with spreadsheet file formats: PHPExcel PHPExcel is a library written in pure PHP and providing a set of classes that allow you to write to and read from different spreadsheet file formats,…
simhumileco
  • 31,877
  • 16
  • 137
  • 115
29
votes
5 answers

how to get date from excel using PHPExcel library

I am trying to get Date from excel using PHPExcel. But I am not getting date, I am getting string value which is not seconds from 1970 . Code I have tried is $InvDate=trim($excel->getActiveSheet()->getCell('B' . $i)->getValue());
user2934950
  • 291
  • 1
  • 3
  • 3
28
votes
13 answers

PHPExcel_Writer_Exception with message "Could not close zip file php://output."

I'm using PHPExcel to export some data to user in an excel file. I would like the script to send the excel file to the user immediately after it's creation. Here is my test code: try{ /* Some test data */ $data = array( array(1, 10 , 2 …
Pavel L
  • 921
  • 2
  • 9
  • 16
28
votes
2 answers

How to PHPExcel set auto-columns width

I'm working with PHPExcel to export data for download. When open downloaded files, with cells have big number, it show "#######" instead of value number. I'm tried setAutoSize() for every columns then call $sheet->calculateColumnWidths() but it…
Davuz
  • 5,040
  • 13
  • 41
  • 61
27
votes
3 answers

PHPExcel outputting zeros as blank cells

I'm building a WordPress plugin using PHPExcel to export reports of student attendance. So far, I'm able to successfully take the array of student data (including attendance) and convert and download it as a spreadsheet. Unfortunately, there's an…
Slushman
  • 315
  • 1
  • 3
  • 8
27
votes
8 answers

How to fix memory getting exhausted with PHPExcel?

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 1078799 bytes) in D:\xampplite\htdocs\Scraper\PHPExcel\Reader\Excel2007.php on line 269 My 128M PHP memory limit quickly gets exhausted even when I am only…
Shubham
  • 21,300
  • 18
  • 66
  • 89
26
votes
5 answers

PHPExcel - How to make part of the text bold

How do you create a bold cell value using PHPExcel? I know I can use \n to add a carriage return within the text, but is there some kind of way to bold part of cell value? I also have tried using html formatting such as or but it did…
Ahmad Satiri
  • 459
  • 1
  • 7
  • 16
25
votes
3 answers

Adding Image to the Excel in phpexcel in php

I am taking the example from phpexcel I just tried with passing value in GET Method, I am done with that. Now i am trying to add image in the a3 coloumn. Reference Code :
AngularAngularAngular
  • 3,589
  • 5
  • 25
  • 41
25
votes
2 answers

How can insert formula in excel sheet using phpexcel

I have checked many sites for solution of my problem but not found proper solution. I want to insert formula which will calculate the total of marks obtained by students. Marks will will be entered by teachers. I have written the php code which is…
user3100533
  • 505
  • 2
  • 8
  • 20
24
votes
8 answers

PHPExcel runs out of 256, 512 and also 1024MB of RAM

I don't understand it. The XSLX table is about 3MB large yet even 1024MB of RAM is not enough for PHPExcel to load it into memory? I might be doing something horribly wrong here: function ReadXlsxTableIntoArray($theFilePath) { …
Richard Knop
  • 81,041
  • 149
  • 392
  • 552
24
votes
4 answers

How do I read sheet two of an xlsx file with PHPExcel?

I know how to read my xlsx spreadsheet and loop through the first sheet. It has 5 sheets and I am having trouble getting to any other than the first. Here is the code I am using which was straight from the documentation. You can see I tried to…
Tom
  • 1,971
  • 3
  • 22
  • 32
22
votes
3 answers

PHPExcel how to get column index from cell

PHPExcel $cell->getColumn() returns 'A', 'B', 'C', ... which is the best way to get the integer (0, 1, 2, ...) from the cell. This function doesn't exist. $colIndex = $cell->getColumnIndex(); So what is the alternative withoput converting chr to…
john Griffiths
  • 247
  • 1
  • 2
  • 5
22
votes
6 answers

PHPExcel - set cell type before writing a value in it

Do you know how can I set the cell type before writing a value in it? I would like to be able to set types like "General", "Text" and "Number". Thank you.
Psyche
  • 8,513
  • 20
  • 70
  • 85