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
14
votes
4 answers

How to include phpspreadsheet library without composer?

There isn't a way for me to run composer on my server for a bunch of reasons. Is there any way to include all the files necessary to use the library?
user187809
  • 706
  • 2
  • 8
  • 23
14
votes
3 answers

How to change cell color in PHPSpreadsheet

Are you able to change the color of a cell in a .xlsx file with PHPspreadsheet? Couldn't find anything in their function list or on Stack Overflow.
jdwee
  • 573
  • 1
  • 5
  • 15
14
votes
4 answers

How to set cell padding in PHPExcel?

Does anyone know how it's possible to set cell padding in PHPExcel ? Searched for 30mins and still can't find a proper solution. There is no useful documentation on this.
Sliq
  • 15,937
  • 27
  • 110
  • 143
13
votes
2 answers

PHPSpreadsheet - How do create a extra tab?

I create in my php code a excel file with one tab and give it a name. The code what i use is this.: // CREATE PHPSPREADSHEET OBJECT require "../vendor/autoload.php"; use PhpOffice\PhpSpreadsheet\Spreadsheet; use…
Pascal
  • 427
  • 2
  • 6
  • 13
12
votes
5 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
  • 566
  • 2
  • 9
  • 22
12
votes
1 answer

PhpSpreadsheet foreach loop through multiple sheets

I'm new to PhpSpreadsheet, I have a file with multiple sheets (all the same), I checked all the examples in the Reader section of the documentation, but each example ends with a code like $sheetData = $spreadsheet->getActiveSheet()->toArray(null,…
uomopalese
  • 471
  • 1
  • 5
  • 21
10
votes
3 answers

number cell format with text

I want to export my data to excel using phpspreadsheet but my data is number in 12 character. So I need to display all the character (121212121212) instead of (1.21212E+11). I have try the format…
c.wen
  • 165
  • 1
  • 2
  • 10
10
votes
2 answers

How to middle align cell value in PhpSpreadsheet?

I want to align the cell value to the middle. My output looks like this:- My expected output should be this: I want every column to be in the center. I tried the following code: $styleArray = [ 'font' => [ 'bold' => true, ], …
kunal
  • 4,122
  • 12
  • 40
  • 75
10
votes
4 answers

PhpSpreadsheet return file instead of saving it

I have generated xmlx file and I am able to save it and provide it for the user via: $writer->save('hello world.xlsx'); header('Location: hello world.xlsx'); However, then the file remains on the hard drive. I need to get rid of it as it is a…
Brambor
  • 604
  • 1
  • 8
  • 25
10
votes
4 answers

PhpSpreadsheet - get row without iterating on each cell

I'm using PhpSpreadsheet to easily read from a xls document and insert into a DB after some calculations. I succeeded using examples from the documentation, but I find it sooo complicated I'm sure I missed something and it can be done much more…
Jeremy Belolo
  • 4,319
  • 6
  • 44
  • 88
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
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
2 answers

PHP-Spreadsheet: First Row Bold

Because PHP-Excel is deprecated, PHP-Spreadsheet is the new Option to make Excel in PHP. The Documentation is not the best and the're not many questions on Stackoverflow about PHP-Spreadsheet, so that's why I make this Question about how to make the…
Silvan Kisseleff
  • 258
  • 2
  • 11
9
votes
4 answers

Read XLS in PHP using PhpSpreadsheet

I have a requirements to read XLS files (not xlsx) using PhpSpreadsheet and I having trouble. I tried this (as the documentation say but...) require 'vendor/autoload.php'; use PhpOffice\PhpSpreadsheet\Spreadsheet; $spreadsheet =…
Ari Waisberg
  • 1,186
  • 1
  • 12
  • 23
1
2
3
57 58