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
13
votes
3 answers

When using PHPExcel, why is the autosize stretching my image?

I am creating a spreadsheet using the PHPExcel Class. I have several columns of data. I am using the autosize method in order to have them take the size of the longest data value in each column. EDIT - Here is my full code to show more…
zeckdude
  • 15,877
  • 43
  • 139
  • 187
13
votes
2 answers

Using PHPExcel to make automatic generated excel files

I want to have my excel file filled with some data which I get from my database, for example the name and age of someone. Say there are 10 people in my database. I want those 10 people in my Excel file. So basically, you would get: NAME …
Andre
  • 893
  • 2
  • 9
  • 30
12
votes
3 answers

PHPExcel Accounting Formats

I'm working with PHPExcel and I'm trying to format a cell using Excel's built-in "Accounting" format. I'm aware of the Format Code: PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_USD_SIMPLE But this simply formats to two decimal places and adds a $…
Matt Brunmeier
  • 1,310
  • 2
  • 11
  • 22
12
votes
4 answers

PHPExcel: Download the Excel file on the client side

The problem was solved: For other users that may have this problem - notice the encoding of the PHP file. If you use PHPExcel it must be ANSII encoding and not UTF8, otherwise the EXCEL will be downloaded corruptly. The Headers that were added…
Alex
  • 169
  • 1
  • 1
  • 9
12
votes
2 answers

Just get one row from PHPExcel

I tried to find a way to just get a row using PHPExcel. After numerous searches on the internet, I only found a way to iterate over them, with an optional start row. This lead to the following solution: foreach…
Bart Friederichs
  • 33,050
  • 15
  • 95
  • 195
12
votes
4 answers

Using PHPExcel to export to xlsx

I am using PHPEXxcel to export an HTML Table generated using MYSQL and its like this.
Ankur
  • 269
  • 2
  • 4
  • 15
12
votes
9 answers

PHPExcel file cannot open file because the file format or file extension is not valid

I'm stuck with this problem, it's not displaying the actual excel file. Please check my code below: /** Error reporting */ error_reporting(E_ALL); /** PHPExcel */ require_once 'PHPExcel.php'; include 'PHPExcel/Writer/Excel2007.php'; // Create new…
user1410081
12
votes
4 answers

PHPExcel Date Format

I am getting an output from MS SQL server in the '2012-08-09 00:00:00' (without quotes) format. However, when I write it to excel file I'm unable to write it in date format to have dd mmm yyyy formatting on excel. As a result i tried to write in…
Saidur Rahman
  • 420
  • 2
  • 6
  • 19
12
votes
1 answer

PhpExcel - How insert the same row after row N?

I have php template. this is a empty table (T0 rows) with some footer at the bottom. From php i try to fill the table, but if i had T1 rows (T1 > T0) then trouble appers. I beleve that empty table should contains one empty row. And we know this row…
Luciuz
  • 1,637
  • 5
  • 14
  • 15
11
votes
1 answer

How can I join Excel documents using PHPExcel?

I'm using PHPExcel to dynamically generate order receipts. I'd like to be able to generate a "summary" Excel file, containing all the order receipts (one per worksheet). Is there a way to "join" two (or more) Excel documents into one with PHPExcel ?
mike23
  • 1,312
  • 6
  • 20
  • 32
11
votes
1 answer

Style a range of cells with phpexcel

I'm trying to style an excel table with phpexcel. I do this: $sheet->getStyle('A1:B2')->applyFromArray($style); But it would be better if I can give numeric coordinates. I can use getStyleByColumnAndRow($x, $y) with one cell, but not with a range.…
M--
  • 375
  • 1
  • 2
  • 11
11
votes
1 answer

Use PHPexcel to find highest non-empty column/row cheaply (on Google Sheets export)

When importing a Google Sheets-exported .xlsx file in PHPExcel, PHPexcel methods $worksheet->getHighestDataColumn() and $worksheet->getHighestDataRow() both return the maximum set in Google Docs, including completely empty cells, which is usually…
Ruben
  • 3,452
  • 31
  • 47
11
votes
2 answers

How to generate a big Excel file with php?

I have to generate automatically Excel file, the Excel file contains 15.000 to 50.000 rows and 75 columns. It is obtained using a join and formulas in Excel (68 Excel formulas, there are IF, IFERROR, COUNTIF ...). So I opted for the library…
Krokodile
  • 115
  • 1
  • 1
  • 5
11
votes
2 answers

'The filename 062014.xlsx is not recognised as an OLE file'

I am working on a complex program that deals with Excel, so I am using PHPExcel to search and edit the Excel file from a browser. My problem comes in the editing portion of the program, so I wrote a basic program to edit the existing Excel page. …
Demosthenes
  • 115
  • 1
  • 1
  • 5
11
votes
3 answers

Protect the Excel file using PHPExcel

How can I create password protected excel sheet using PHPExcel, I know how to protect excel sheet using $G=$objPHPExcel->setActiveSheetIndex(0); $G->getProtection()->setSheet(true); But I am not getting any link how to set the password for editing…
user3100533
  • 505
  • 2
  • 8
  • 20