Questions tagged [phpspreadsheet]

PhpSpreadsheet is a library written in pure PHP and providing a set of classes that allow you to read from and to write to different spreadsheet file formats, like Excel and LibreOffice Calc.

See:

702 questions
73
votes
7 answers

Setting width of spreadsheet cell using PHPExcel

I'm trying to set the width of a cell in an Excel document generated with PHPExcel…
user198003
  • 10,571
  • 27
  • 90
  • 146
43
votes
3 answers

Merge Cell values with PHPExcel - PHP

I have a simple table like: - id - first_name - last_name - email - phone I'm using PHPExcel to export my data in XLS format $rowNumber = 1; while ($row = mysql_fetch_row($result)) { $col = 'A'; foreach($row as $cell)…
Cheerio
  • 1,148
  • 6
  • 17
  • 35
27
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
  • 21,911
  • 14
  • 106
  • 90
25
votes
4 answers

How to use PhpSpreadsheet without installation (like PHPExcel)

According to the PhpSpreadsheet Doc it's neccessary to install it with composer. In my case I just have a webspace without Terminal but Plesk. Is it anyway possible to use PhpSpreadsheet, like it is with PHPExcel where you just have to place the…
MaggusK
  • 395
  • 1
  • 5
  • 12
19
votes
7 answers

Composer require phpoffice/phpspreadsheet doesn't work

I want to write a Script using the package Phpspreadsheet. I am not experience in php. I am trying to add the reference to my script through sudo composer require phpoffice/phpspreadsheet. But it doesn't work. I am getting the error: In stallation…
MrScf
  • 1,789
  • 2
  • 18
  • 36
17
votes
2 answers

Building very large spreadsheet with PHPSpreadsheet

I'm testing out how PHPSpreadsheet works with large excel spreadsheets. Initial tests indicate that for a large spreadsheet one will quickly run out of memory. Is there a way to write the spreadsheet progressively? I have an old piece of code that…
xtempore
  • 4,669
  • 4
  • 28
  • 40
16
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
  • 193
  • 1
  • 1
  • 9
16
votes
2 answers

Download PhpSpreadsheet file without save it before

I'm using PhpSpreadsheet to generate an Excel file in Symfony 4. My code is: $spreadsheet = $this->generateExcel($content); $writer = new Xlsx($spreadsheet); $filename = "myFile.xlsx"; $writer->save($filename); // LINE I WANT TO AVOID $response =…
Genarito
  • 1,971
  • 3
  • 17
  • 38
15
votes
1 answer

PHPSpreadsheet: how to get the number of loaded rows?

How do I find out how many rows I have loaded using PHPSpreadsheet\Reader\Xlsx::load() method? I cannot find methods (or properties) for getting row count in Spreadsheet or Worksheet classes either. BTW I am using following code: $filename =…
Pontiac_CZ
  • 558
  • 1
  • 4
  • 11
14
votes
4 answers

How to retrieve date from table cell using PhpSpreadsheet?

I have xlsx tables and I use PhpSpreadsheet to parse them. Some cells format is date. The problem is that PhpSpreadsheet returns the values from date-formatted cells in an unspecified format: // How it looks in excel: 2017.04.08 0:00 $value =…
Finesse
  • 6,684
  • 6
  • 44
  • 60
12
votes
3 answers

Write data from array to sheet using phpspreadsheet library

How can I create excel sheet column headers from array using phpspreadsheet library? Below is the code I am trying but it's not working: // $header is an array containing column headers $header = array("Customer Number", "Customer Name",…
Gurpreet Kaur
  • 119
  • 1
  • 1
  • 5
11
votes
3 answers

PHPSpreadsheet - How do i place a image from link into my excel file?

I would like to place a image in cell a1 from my excel file. I tryed different things from phpspreadsheet website but all without succes. Like this example from them that does'nt work.: $drawing = new…
Pascal
  • 301
  • 1
  • 4
  • 10
11
votes
3 answers

Center all text in PHPSpreadsheet and make the cells expand to fill up with context

I struggle a bit to make all the cells set the context to center and to autoexpand so it doesnt overlap each other. So what I try to do is: Set the info in every cell to be centered since it makes better for printing to PDF/etc. Make the cells…
stAMy
  • 363
  • 1
  • 4
  • 13
10
votes
2 answers

PhpSpreadsheet set background color of cell to white

Using PhpSpreadsheet, I want to set a white background to the excel cell. $cells = 'A1'; $spreadsheet ->getActiveSheet() ->getStyle($cells) ->getFill() ->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID) …
Premlatha
  • 1,081
  • 1
  • 11
  • 24
9
votes
4 answers

Read Xlsx file in PhpSpreadsheet

I want to read an xlsx file that was created in Microsoft Excel, but when I run the following code... $Source_File = "test.xlsx"; $Spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($Source_File); ...I receive the following error: Fatal error:…
Arya
  • 427
  • 2
  • 5
  • 20
1
2 3
46 47