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
10
votes
1 answer

Getting unwanted characters like "_x000D_" or "x000D" in PHPExcel

I am using PHPExcel for reading and storing data from Excel, but whenever I read a row from the Excel file to insert into the database, _x000D_ or x000D is appended to the title column. Example: when inserting, the title is 'Demo', and after reading…
Farman Khan
  • 101
  • 1
  • 1
  • 4
10
votes
4 answers

PhpSpreadsheet is corrupting files

I am using PhpSpreadsheet to modify an existing file and send it to the browser, but every time I download the file excel gives me the following error: We found a problem with some content in filename.xlsx. Do you want us to try and recover as much…
alex_6169
  • 135
  • 1
  • 1
  • 6
10
votes
2 answers

Populate dropdown with phpexcel

I'm running into the following problem. Im trying to get some results from my database and I want to insert the results into a dropdown list. In the examle file was the following example: $objValidation->setFormula1('"Item A,Item B,Item C"'); so the…
Frank W.
  • 777
  • 3
  • 14
  • 33
10
votes
2 answers

Reading very large (more than 100MB) Excel files in PHP

I'm trying to read a larger than 100MB Excel file using PHPExcel but it crashes while loading the file. I don't need any styling. I tried using: $objReader->setReadDataOnly(true); but it still crashes. Is there any efficient way to read this…
Mubeen Ali
  • 2,150
  • 2
  • 18
  • 26
10
votes
4 answers

PHP create xls from array

I try to create xls file from array and download it with the browser with this code: $sheet = array( array( 'a1 data', 'b1 data', 'c1 data', 'd1 data', ) ); $doc = new PHPExcel(); …
YosiFZ
  • 7,792
  • 21
  • 114
  • 221
10
votes
3 answers

PHPExcel get cell currency format other than $ and EUR

PHPExcel uses $ and EUR only: const FORMAT_CURRENCY_USD_SIMPLE = '"$"#,##0.00_-'; const FORMAT_CURRENCY_USD = '$#,##0_-'; const FORMAT_CURRENCY_EUR_SIMPLE = '[$EUR ]#,##0.00_-'; What I need is to get other currencies (I use…
Marek
  • 123
  • 1
  • 1
  • 7
10
votes
3 answers

Append new row to excel file using phpExcel library

I am new to php as well to phpExcel . I just want to save post data to a existing excel sheet every time to a new row. As i searched on Stackoverflow.com i got the reference of library phpExcel. I write down the following code from taking some…
rahularyansharma
  • 11,156
  • 18
  • 79
  • 135
10
votes
3 answers

How to convert Excel File-Format to G-Sheet by Drive API upload?

I can upload and convert CSV files by Drive API without any problem, but when sending XLS (rendered with PEAR XLS-Writer) or XLSX (rendered with PHPExcel) the Drive API complains: "Error calling POST…
Martin Zeitler
  • 1
  • 19
  • 155
  • 216
9
votes
3 answers

Import an excel file into a MySQL table with PHPExcel

Ok so I have been able to get php to show the data in excel .xls sheet but this same data I wanna be able to insert into my table. I can't seem to figure that part out, here's what I got so far: $path =…
Andres
  • 2,013
  • 6
  • 42
  • 67
9
votes
2 answers

PHPExcel Error: Array and string offset access syntax with curly braces is deprecated

I've just updated my phpexcel to phpspreadsheet, and I noticed this error pops up: ErrorException (E_DEPRECATED) Array and string offset access syntax with curly braces is deprecated require 'Classes/PHPExcel.php'; here is part of my code which…
Maqsud
  • 739
  • 3
  • 12
  • 35
9
votes
3 answers

PHP SpreadSheet can't find the function to auto size column width

I simply want the columns to autosized. I am using php spreadsheet and I can't find how to do it. Any advise ? This is my code $spreadsheet = new Spreadsheet(); $sheet = $spreadsheet->getActiveSheet(); $sheet->setCellValue('A1', 'Projects First…
ThunderBoy
  • 391
  • 1
  • 3
  • 18
9
votes
3 answers

How to add new row on Excel using PHPSpreadsheet

Hi I'm new to this library called PHPSpreadsheet. I tried reading it's docs but I can't understand it. I want to insert a new row on an existing Excel File and here is what I have so far:
jpneey
  • 620
  • 1
  • 9
  • 16
9
votes
1 answer

phpexcel Allowed memory size of 134217728 bytes exhausted

I am using phpexcel to write quite a large excel file. I am writing it from an array that looks like array( [0] => stdClass Object ( [sent] => Mar 31st, 2011 02:10PM [to_number] => 64211111111 …
Hailwood
  • 89,623
  • 107
  • 270
  • 423
9
votes
3 answers

copy style and data in PHPExcel

I would like to copy all the data and the style of a certain range to other cells. for example I want to copy from A4: I15 and then paste exactly want I copied the contents and styles from A16. How can I do it?. this is what I want to copy: I know…
user5115790
9
votes
4 answers

PHPExcel - How can i read the Excel sheet row by row

How can i read Excel worksheet row by row using PHPExcel? I have a sheet contains more than 100000 rows, but i want to read only 500 rows. $sheetData = $objPHPExcel->getActiveSheet(); $highestRow = $sheetData->getHighestRow(); $highestColumn =…
noufalcep
  • 3,446
  • 15
  • 33
  • 51