Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 11:08
    MarkBaker closed #3214
  • 11:07

    MarkBaker on master

    Store the currently selected ce… Merge branch 'master' into Issu… Merge pull request #3220 from P… (compare)

  • 11:07
    MarkBaker closed #3220
  • 10:48
    MarkBaker synchronize #3220
  • 10:48

    MarkBaker on Issue-3214_Xlsx-Reader-Adjusts-Selected-Cell-when-Loading-CF-Ranges

    Sync composer.lock/.json and Ph… Merge branch 'master' into Issu… (compare)

  • 10:13
    MarkBaker synchronize #3220
  • 10:13

    MarkBaker on Issue-3214_Xlsx-Reader-Adjusts-Selected-Cell-when-Loading-CF-Ranges

    Store the currently selected ce… (compare)

  • 09:59
    MarkBaker opened #3220
  • 09:57

    MarkBaker on Issue-3214_Xlsx-Reader-Adjusts-Selected-Cell-when-Loading-CF-Ranges

    Store the currently selected ce… (compare)

  • 09:54
    MarkBaker edited #3214
  • 09:53
    MarkBaker edited #3214
  • 09:53
    MarkBaker edited #3214
  • 06:40
    RahulVerma989 starred PHPOffice/PhpSpreadsheet
  • 05:59
    oleibman synchronize #3219
  • 05:27
    oleibman opened #3219
  • 05:04
    oleibman synchronize #3218
  • 03:49
    oleibman opened #3218
  • 02:17
    wackyblackie starred PHPOffice/PhpSpreadsheet
  • 01:23
    Xieyongmin starred PHPOffice/PhpSpreadsheet
  • Nov 29 17:57
    jarwonozt commented #3087
hemant123misha
@hemant123misha
I have a .xls file having a formula in formula bar, when i am trying to read it out by calculated value getting formula error.
xeon826
@xeon826
Is it possible to generate the download to php://output without writing it to the file system first?
I have an SQL query that returns the rows in json format, I'd like to just convert it straight to csv, or xls and generate a download
Adrien Crivelli
@PowerKiKi
@xeon826 no, it's not, see https://github.com/PHPOffice/PhpSpreadsheet/issues/28#issuecomment-399120802 and the other related posts over there
Timothy
@tdawes33
Is there a way to get the hash of a sheet before loading it? It seems like listWorksheetInfo() would provide that if it exists Doing a compare between two identical (and complex) sheets requires loading/processing the entire sheet according to my understanding.
Thomas Kristian Jeriko
@jerikothomas
is there a way to create chart from time (over 24 hours) base values ?
Fräntz Miccoli
@frantzmiccoli
@jerikothomas you have an example of line chart here that I guess you can adapt to your data. https://github.com/PHPOffice/PhpSpreadsheet/blob/master/samples/Chart/33_Chart_create_line.php
Ram Mogal
@rammogal
Hi , I am using phpspreadsheet library in Zedn 3 Framework.
Hi , I am using phpspreadsheet library in Zedn 3 Framework.
I have copied the folder and pasted it in my vendor directory, now how can I register this library and use its namespaces in my own module
Stephen Ostrow
@isleshocky77
Is there anywhere documenting the Release process and Schedule? I see the next milestone is for 2.0; however, the last release was 1.6 on Jan 1. There are very useful commits on master fixing bugs within the codebase. Will there be a 1.6.1 or 1.7 which come out before 2.0 ?
Adrien Crivelli
@PowerKiKi
@rammogal copying the folder will not work, instead delete the things you copied and follow the instruction there: https://phpspreadsheet.readthedocs.io/en/latest/#installation
@isleshocky77 there is no formal release schedule. I try to release roughly every month, but I've been particularly busy lately. I'll see what I can do in the coming days...
Stephen Ostrow
@isleshocky77
@PowerKiKi Awesome.. Yeah, I saw you were releasing monthly if not bi-monthly for the last part of 2018 (which got me excited), but that release is now Jan 1. I've pinned my dependency to dev-master#commitish for now. Thanks for the response and for the hard work. Interesting enough I came across the getHighestColumn() bug today and thought I must be crazy or using it wrong. Then I found the Unit test and fix for it which happened very recently. Worked like a charm.
Rico29
@Rico29
Hello, I'm trying for hours to get the background color of a cell in an ODS file. I tried many many ways, but I never found what I'm looking for. can somebody point me in the right direction please ?
Rico29
@Rico29
It works fine when converting file to xlsx, with $spreadsheet->getActiveSheet()->getStyle('B2')->getFill()->getStartColor()->getRGB();
deepakjoshii
@deepakjoshii
3.00 values changes to 3 in excel sheet
graslo
@graslogamer_twitter
Just installed with composer. Trying out samples but can't find them. Where is the /tmp/ folder supposed to be?
Running sample tells me: "20:49:40 Write Xlsx format to /tmp/phpspreadsheet/01_Simple.xlsx in 0.0325 seconds"
But can't find that anywhere
Adrien Crivelli
@PowerKiKi
@graslogamer_twitter /tmp/phpspreadsheet/01_Simple.xlsx is an absolute path. It exists at the root of your filesystem, not in your current folder/project. Copy/paste that path exactly as is in your favorite spreadsheet editor and it should be able to find it
graslo
@graslogamer_twitter
@PowerKiKi thank you
Salman Tariq
@stariqmi
Is there a migration guide from PHPExcel to PHPSpreadsheet? I have to upgrade to PHP 7.3 and can no longer use PHPExcel
Salman Tariq
@stariqmi
Sorry - I should have searched more. Found the doc from searching stackoverflow :)
Olaitan .M. Adeboye
@Mercyware
Hello
I am trying to get Images from excel using getDrawingCollection(). However, i need to be able to know the cell that has the image. Is that possible ?
Adrien Crivelli
@PowerKiKi
@Mercyware try
$spreadsheet->getActiveSheet()->getDrawingCollection()[0]->getCoordinates();
dack94
@dack94

Hi all :) I'm creating an excel with PhpSpreadsheet (no prob with that ). I'm working with MVC pattern so flow is :
1) User press download button and call function in controller
2) function in controller call a function in an helpers to create the excel

Now it's a very very long task and i'd like to show the progress of this long task (like a download bar). I've tried with all things that i know (ajax polling , iframe, sse, session variable, static variable) but none seems to work. Could you help me ?

Adrien Crivelli
@PowerKiKi

@dack94 I did exactly what you are talking about a long time ago, and it's a surprisingly trick thing to do. I would try to avoid it actually. One serious limitation with normal ajax thing is the browser limitation of 2 connection to a given server. So in some condition, your ajax polling might not actually start before the excel file is done generating. Anyway here is my solution that you will have to adapt.

Utility Class:

<?php

namespace Application\Utility;

/**
 * This class implements ways to know when a long process is running on
 * the server and when the said process is complete.
 *
 * This file *MUST NOT* be part of Zend code because it has to be accessible concurrently
 * to any process that may occur at the same time by another HTTP request. Hence we
 * cannot use session and cannot use ACL security system neither. It must stay totally
 * separated from all other code.
 */
abstract class Progress
{
    private static $currentIdProgress = '';

    /**
     * Returns the path for the path for the lock file for the specified ID of progress
     *
     * @param string $id
     *
     * @return string
     */
    private static function getLockFilePath(string $id): string
    {
        // Here we use MD5 to prevent security hole to access filesystem with '.' or '/' characters in $id
        return __DIR__ . '/data/tmp/progress_' . md5($id) . '.lock';
    }

    /**
     * Notify the beginning of a long process
     *
     * @param string $id
     */
    public static function start(string $id): void
    {
        self::$currentIdProgress = $id;
        touch(self::getLockFilePath($id));
    }

    /**
     * Notify the end of a long process
     */
    public static function end(): void
    {
        $path = self::getLockFilePath(self::$currentIdProgress);
        if (file_exists($path)) {
            unlink($path);
        }
    }

    /**
     * Allow to poll the status of a progress by its ID
     *
     * @param string $id id of progress
     *
     * @return string current status of progress
     */
    public static function status(string $id): string
    {
        if ($id && file_exists(self::getLockFilePath($id))) {
            return $id . ' in progress ...';
        }

        return '';
    }
}

Then your javascript would start the download with an arbitrary "process id". Any string generated in JS. When starting to generate the excel file and you receive that id in PHP, you would call:

Progress::start($_REQUEST['id']);
$spreadsheet = createMySpreadsheet();
Progress::end();
sendSpreadsheetToBrowser($spreadsheet);

In parallel the JS would start to poll a different endpoint. That endpoint MUST be completely separate from your application and it MUST NOT use PHP session at all. In that new endpoint you use:

<?php

/**
 * This file *MUST NOT* be part of Zend code because it has to be accessible concurrently
 * to any process that may occur at the same time by another HTTP request. Hence we
 * cannot use session and cannot use ACL security system neither. It must stay totally
 * separated from all other code.
 */
require_once __DIR__ . '/../vendor/autoload.php';
echo \Application\Utility\Progress::status($_REQUEST['id']);

The JS can then show an non-deterministric progress bar, until the endpoint says it's over

ahsanmahmood
@ahsanmahmood
i am new with php sread sheet
need help how to use in laravel5.8
any video tutorial or anything docs etc
my email is aoneahsan@gmail.com
lalilalai
@lalilalai
Hello, I newer in licenses and I want to know, can I use PHPOffice/PhpSpreadsheet in my MIT PHP project? Thank you in advance
Adrien Crivelli
@PowerKiKi
lalilalai
@lalilalai
@PowerKiKi Thanks a lot
Marefandho
@marefandho
hai, can someone help ? about using it
I've got Class 'PhpOffice\PhpSpreadshasdeet\Spreadsheet' not found
install it using composer and trying the simple script as it told on online docs

<?php

require 'vendor/autoload.php';

use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;

$spreadsheet = new Spreadsheet();
$sheet = $spreadsheet->getActiveSheet();
$sheet->setCellValue('A1', 'Hello World !');

$writer = new Xlsx($spreadsheet);
$writer->save('hello world.xlsx');

Marefandho
@marefandho
ah finally got the answer, if someone having the same problem like me
use \PhpOffice\PhpSpreadsheet\Spreadsheet;
use \PhpOffice\PhpSpreadsheet\Writer\Xlsx;
ade more backslash before PhpOffice
dabrjn
@dabrjn
composer installation of phpshreadsheet failing on linux2 box with php7.3.

Error is :
[InvalidArgumentException]
Package phpoffice/phpspreadsheet at version has a PHP requirement incompat ible with your PHP version (5.4.16)

Any idea how to fix?

Adrien Crivelli
@PowerKiKi

incompatible with your PHP version (5.4.16)

=> upgrade your PHP Version
@dabrjn

dabrjn
@dabrjn
Never could fix linux2 box php so I created a ubuntu box. All files created using phpspreadsheet cannot open in Excel. Error message is "Excel cannot open the file 'filename.Xlsx' because the file format or file extension is not valid. Verify that the file has not been corrupted and that the file extension matches the format of the file." Is phpspreadsheet compatible with php 7.3?
dabrjn
@dabrjn
Continuation of above im: Files created using phpspreadsheet on my mac (php7.1.23) and also on a aws linux server (php5.6) work just fine. I did a comparison on loaded/enabled php modules between mac and ubuntu and the following ones are not on the ubuntu box, but are on the mac: bcmath, bz2, dba, ldap, pdo_pgsql, pdo-sqllite, and pgsql. Could one of these missing be an issue? I'm not using pdo, but do use mysqli calls, but even the simplest spreadsheet fails with same message. All that simple spreadsheet did was put some text in several cells.
dabrjn
@dabrjn
Continuations of above im: Problem solved. Had to issue ob_end_clean() immediately prior to $writer->save('php://output'); Why this is required on ubuntu box with php7.3 and not the other machines is puzzling, but problem is solved.
Tolga Ozses
@kartagis
hello
Tolga Ozses
@kartagis
is there a way to write to xlsx without specifying getCell()? dynamically I mean.
Adrien Crivelli
@PowerKiKi
@kartagis not sure to understand what you need, but maybe have a look at \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::fromArray()
Tolga Ozses
@kartagis
@PowerKiKi that might work for my use case. I would first read from the PDF and stuff that into an array, then use fromArray()