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:

859 questions
82
votes
8 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
  • 11,029
  • 28
  • 94
  • 152
46
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,260
  • 6
  • 19
  • 37
42
votes
13 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
  • 2,407
  • 5
  • 27
  • 40
36
votes
6 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
  • 605
  • 1
  • 8
  • 12
30
votes
5 answers

How to retrieve date from table cell using PhpSpreadsheet?

I have xlsx tables and I use PhpSpreadsheet to parse them. Some cells are formatted as date. The problem is that PhpSpreadsheet returns the values from date-formatted cells in an unspecified format: // What it looks in excel: 2017.04.08 0:00 $value…
Finesse
  • 9,793
  • 7
  • 62
  • 92
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
25
votes
4 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
  • 5,260
  • 4
  • 36
  • 43
23
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
  • 3,027
  • 5
  • 27
  • 53
21
votes
7 answers

PhpSpreadsheet - Download file instead of saving it

I need to generate an excel file (xls) and trigger the download after it is generated. I found this example in the documentation.
Black
  • 18,150
  • 39
  • 158
  • 271
21
votes
4 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
  • 209
  • 1
  • 2
  • 5
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
19
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
  • 471
  • 2
  • 6
  • 14
18
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,676
  • 2
  • 20
  • 40
18
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
  • 619
  • 1
  • 6
  • 13
15
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
  • 427
  • 2
  • 6
  • 13
1
2 3
57 58