phpspreadsheet

How to retrieve date from table cell using PhpSpreadsheet?

安稳与你 提交于 2019-12-05 05:33:18
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 = $worksheet->getCell('A1')->getValue(); // 42833 - doesn't look like a UNIX time How to get the date from a cell in form of a UNIX time or a DateTimeInterface instance? The value is amount of days passed since 1900. You can use the PhpSpreadsheet built-in functions to convert it to a unix timestamp: $value = $worksheet->getCell('A1')->getValue(); $date =

Read Xlsx file in PhpSpreadsheet

社会主义新天地 提交于 2019-12-04 12:50:24
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: Uncaught PhpOffice\PhpSpreadsheet\Reader\Exception: Unable to identify a reader for this file in /var/www/html/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/IOFactory.php:163 Stack trace: #0 /var/www/html/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/IOFactory.php(93): PhpOffice\PhpSpreadsheet\IOFactory::createReaderForFile('file:///home

Composer require phpoffice/phpspreadsheet doesn't work

前提是你 提交于 2019-12-03 13:36:43
问题 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 failed, deleting composer.json....If have no idea why it is not working. Any idea? Detailed Error: Your requirements could not be resolved to an installable set of packages. Problem 1 - Installation request for phpoffice/phpspreadsheet ^1.0 ->

Setting width of spreadsheet cell using PHPExcel

牧云@^-^@ 提交于 2019-12-02 17:48:59
I'm trying to set the width of a cell in an Excel document generated with PHPExcel with: $objPHPExcel->getActiveSheet()->getColumnDimensionByColumn('C')->setWidth('10'); $objPHPExcel->getActiveSheet()->getColumnDimensionByColumn('C')->setAutoSize(false); but that does not works. What is the method that I need to call here? Jahmic It's a subtle difference, but this works fine for me: $objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(10); Notice, the difference between getColumnDimensionByColumn and getColumnDimension Also, I'm not even setting AutoSize and it works fine.

PHPSpreadsheet generates an error “Wrong number of arguments for INDEX() function: 5 given, between 1 and 4 expected”

混江龙づ霸主 提交于 2019-12-02 04:24:18
I tried to enter the following code in my excel formula bar directly =INDEX($E$4:$E$132,AGGREGATE(15,6,ROW($1:$30) / ($J$4:$J$132=M4), COUNTIF($M$4:M4, M4))) and works perfectly fine (the left column on the pic below). But if I'm using my web application to generate an excel report file (PHP, using CodeIgniter and Laravel). It displays an error " 'Wrong number of arguments for INDEX() function: 5 given, between 1 and 4 expected' " Here's my sample code snippet: $code = "=INDEX(\$E\$4:\$E\$$occurance, AGGREGATE(15,6,ROW(\$1:\$$occurance) / (\$J\$4:\$J\$$occurance=M$top_cell), COUNTIF(\$M\$4:M

What are the main differences between PHPExcel and PhpSpreadsheet?

只愿长相守 提交于 2019-11-30 17:17:27
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, like Excel (BIFF) .xls, Excel 2007 (OfficeOpenXML) .xlsx, CSV, Libre/OpenOffice Calc .ods, Gnumeric, PDF, HTML, ... This project is built around Microsoft's OpenXML standard and PHP. and PhpSpreadsheets 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

Excel - Getting the Top 5 data of a column and their matching title but produces duplicates

…衆ロ難τιáo~ 提交于 2019-11-29 18:37:01
I am developing a web application made using PHP (withh CodeIgniter as the framework) that should produce an excel file report as as summary of data. I am using PHPSpreadsheet as a library to generate the .xlsx file and everything is successful. I was able to display in a certain range of cell the top 5 values of a column ie. Top 5 Publications that has the most number of Articles . With the use of the code =LARGE(ColumnOfTheDataRange , NumeralValue) -- I was able to get the top 5 of what I wanted Then, on the left side of these top 5 data, I need to display the matching Publication Names /

What are the main differences between PHPExcel and PhpSpreadsheet?

不想你离开。 提交于 2019-11-29 11:18:56
问题 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, like Excel (BIFF) .xls, Excel 2007 (OfficeOpenXML) .xlsx, CSV, Libre/OpenOffice Calc .ods, Gnumeric, PDF, HTML, ... This project is built around Microsoft's OpenXML standard and PHP. and PhpSpreadsheets PhpSpreadsheet is a library written in pure

How to use PhpSpreadsheet without installation (like PHPExcel)

本秂侑毒 提交于 2019-11-27 21:39:50
问题 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 files in any location? What do I have to do to get it run? I found no further information how to with only FTP webserver access. 回答1: In your case there are two options for you! Answer: 1 Alternative method without terminal Run composer with a PHP