PhpSpreadsheet | A pure PHP library for reading and writing spreadsheet files | Data Visualization library

 by   PHPOffice PHP Version: 1.28.0 License: MIT

kandi X-RAY | PhpSpreadsheet Summary

kandi X-RAY | PhpSpreadsheet Summary

PhpSpreadsheet is a PHP library typically used in Analytics, Data Visualization applications. PhpSpreadsheet has no bugs, it has no vulnerabilities, it has a Permissive License and it has medium support. You can download it from GitHub.

PhpSpreadsheet is a library written in pure PHP and offers a set of classes that allow you to read and write various spreadsheet file formats such as Excel and LibreOffice Calc.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              PhpSpreadsheet has a medium active ecosystem.
              It has 12240 star(s) with 3051 fork(s). There are 312 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 162 open issues and 1553 have been closed. On average issues are closed in 39 days. There are 22 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of PhpSpreadsheet is 1.28.0

            kandi-Quality Quality

              PhpSpreadsheet has 0 bugs and 0 code smells.

            kandi-Security Security

              PhpSpreadsheet has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              PhpSpreadsheet code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              PhpSpreadsheet is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              PhpSpreadsheet releases are available to install and integrate.
              PhpSpreadsheet saves you 50896 person hours of effort in developing the same functionality from scratch.
              It has 68998 lines of code, 4205 functions and 454 files.
              It has high code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed PhpSpreadsheet and discovered the below as its top functions. This is intended to give you an instant insight into PhpSpreadsheet implemented functionality, and help decide if they suit your requirements.
            • Get next token
            • Write the Theme
            • Process token stack .
            • Parses the formula into an array .
            • Write a value axis .
            • Compute Hqr2 - 2
            • Write a CRLF rule .
            • Apply style from array
            • Insert new before a cell .
            • Get Shadow presets map
            Get all kandi verified functions for this library.

            PhpSpreadsheet Key Features

            No Key Features are available at this moment for PhpSpreadsheet.

            PhpSpreadsheet Examples and Code Snippets

            No Code Snippets are available at this moment for PhpSpreadsheet.

            Community Discussions

            QUESTION

            How can I use phpoffice to extract a specific worksheet from an .xlsx file and create a new .xlsx from it?
            Asked 2022-Apr-15 at 02:28

            I have one .xlsx file containing several worksheets. This .xlsx is generated using the php library phpoffice / phpspreadsheet. What I need to do is extract a specific worksheet from this file and create a new one - a separate .xlsx file.

            My PHP code look like this:

            ...

            ANSWER

            Answered 2022-Apr-15 at 02:28

            You were close to getting the solution! PhpSpreadsheet allows you to use the clone keyword on sheet objects and then add them to other spreadsheets. I see you're getting this from an uploaded form so a simple check of the MIME Type is probably a good idea.

            Source https://stackoverflow.com/questions/71878959

            QUESTION

            PHPSpreadsheet writer - How to fit content
            Asked 2022-Mar-30 at 10:31

            I've successfully convert Excel to PDF using this code:

            ...

            ANSWER

            Answered 2022-Mar-30 at 10:31

            I think there's no solution for this. So I just reduce the font size. When my data is small, the paper space will be wasted

            Source https://stackoverflow.com/questions/70975516

            QUESTION

            Alternative to processing files on my app service
            Asked 2022-Mar-26 at 22:13

            I'm currently using my app service to process files. I'm uploading Excel files and processing them using PhpSpreadsheet.

            Locally, they're going through in less than 90 seconds (laptop, SSD, i7, 16GB RAM). On my app service (small Linux plan), the same file and script, can take upwards of 10 min. This results in the 504 Gateway Timeout error. I then manually confirm data upload in the database.

            What would be an alternative to this way of processing files?

            Edit #1

            By Processing, I mean uploading an Excel file, going through the rows, extracting data and updating a database using PhpSpreadsheet. My current file is 102KB, has 4300 rows, 23 columns and takes around 6 minutes. Locally, only a few seconds.

            Example:

            ...

            ANSWER

            Answered 2022-Mar-26 at 22:13

            Comments offer some good thoughts on basic options, summarized briefly:

            1. Use a faster server
            2. Make your algorithm for parsing your file (whatever it is) faster.

            Either may alleviate your problem in the short term. However let's say your algorithm is well-optimized and your server is as fast as you're willing to pay for, both of which may be true for you and are often true in real-world cases. Let's also assume that your file size is somewhat unpredictable, so even when well-optimized and fast, you may need to support outlier cases of larger files that are slow to process.

            It sounds like your workflow is (synchronously):

            1. Client sends HTTP request to server with Excel file
            2. PHP Server runs file parsing
            3. Server returns an HTTP 200 (OK) and the parsed file when done. If a request takes > 600 seconds (or whatever the timeout is), it times out and returns a 504.

            I would agree with the comments suggesting taking out Step 2 and putting it in background-job processing. This would make your workflow look like:

            1. Client sends HTTP request to server with Excel file
            2. Server sends the Excel file to a background job processor ASYNCHRONOUSLY, starting the processing but not waiting for it to finish.
            3. Server returns an HTTP "201 Created" saying the server has started processing the file.
            4. Client polls a Job Status endpoint on the server every n seconds to check if the job is done

            There are a LOT of different ways to do this (the above background processing link details a few Azure-esque ways).

            One Azure-centric way I can think of is to use a function app triggered by a queue. In this case, your server could accept an Excel File, persist it somewhere (or your client could upload it directly to Azure Blob Storage), and then adds an entry to your Queue, saying where your file to be processed is. Using a queue trigger, this can then automatically trigger your function app code, which can pull the oldest message from your queue, go and find the file to be processed, process it in as much time as it takes, and then upload the "processed" file back to blob storage for client consumption.

            I know less about PHP background job tooling, hence the Azure-ness of the above suggestions, but there are definitely dozens of other ways to do the same basic workflow proposed above, and the benefit of the above is that you can implement it using basically any language you want, the core architecture remains the same.

            Source https://stackoverflow.com/questions/71628110

            QUESTION

            How can I install the phpspreadsheet in codeignter version 4
            Asked 2022-Mar-15 at 05:56

            I have tried to install the package of phpspreadsheet for both way for github and through composer also but I am unable to install In composer i am trying these command :- composer require phpoffice/phpspreadsheet but its not working It's basically show these type of error:- [InvalidArgumentException] Package phpoffice/phpspreadsheet has requirements incompatible with your PHP version, PHP extensions and Composer v ersion: - phpoffice/phpspreadsheet 1.19.0 requires ext-gd * but it is not present. And when i am trying directly for github code its files is not in proper way as the requriement git hub link:- https://github.com/PHPOffice/PhpSpreadsheet

            ...

            ANSWER

            Answered 2022-Mar-15 at 05:56

            phpoffice/phpspreadsheet v1.19.0 requires php: ^7.3 || ^8.0

            1. Check your installed PHP version by running this command php -v. Make sure it's greater or equal to 7.3.

            2. Secondly, make sure that the PHP version declaration in the composer.json file is also greater or equal to 7.3. I.e:

            Source https://stackoverflow.com/questions/70064209

            QUESTION

            PhpSpreadsheet Date::PHPToExcel() adding time
            Asked 2022-Mar-14 at 17:03

            I am trying to add a date field into an Excel file without the time portion.

            This is my current code:

            ...

            ANSWER

            Answered 2022-Mar-14 at 17:03

            Apparently DateTime::createFromFormat() adds the current time if you don't specify it.

            The solution is to add ! in the format to reset all the fields to zero-like values which I got from this comment.

            Source https://stackoverflow.com/questions/71471405

            QUESTION

            How to read multiple xlsx files in a folder and put them into one array?
            Asked 2022-Feb-24 at 11:56

            Tell me how to do it, I have a folder with xlsx files, with 2 arguments name and price

            The task is that I need to pull out information from all files into one array.

            Here is my code

            ...

            ANSWER

            Answered 2022-Feb-24 at 11:56

            You are overwriting the array in the inner loop on the second pass

            Source https://stackoverflow.com/questions/71251201

            QUESTION

            Sending attachments with PHPMailer library
            Asked 2022-Jan-26 at 10:32

            Currently I have a table where I'm displaying all my records. Now I have a functionality to export the table data to an excel sheet. Now when I click export the excel sheet goes to my C:\Xammp\htdocs folder. The following is the code I'm using to save the excel sheet.

            ...

            ANSWER

            Answered 2022-Jan-26 at 10:32

            The problem occurs because you are generating the filename twice, and it's time-dependent, so it can be different each time. Define it once in a variable and then use it for both things:

            Source https://stackoverflow.com/questions/70859593

            QUESTION

            Laravel Excel Row Validation with conditions depends on another field input
            Asked 2022-Jan-21 at 03:26

            I need to validate every rows from excel user upload in laravel which already converted to numeric array.

            The validation i wanted is :

            1. to make sure that the 1st field (0) is not blank,
            2. then check whether the input is 'PRODUCTION-PROJECT' or not, if yes, then the 2nd field is required (1).

            how to achieve this ?

            My Controller Import class

            ...

            ANSWER

            Answered 2022-Jan-21 at 03:24

            The params of Rule::requiredIf should be a callback function that you need to custom the rule and input.

            It's better to change Rule::requiredIf('*.0' === 'PRODUCTION-PROJECT') to 'required_if:*.0,PRODUCTION-PROJECT"'

            so the correct code is :

            Source https://stackoverflow.com/questions/70795461

            QUESTION

            How to use PhpSpreadsheet with App Engine and Google Cloud Storage
            Asked 2022-Jan-17 at 07:36

            I've been banging my head on this one for a few days and thought it was time to ask. The task seems simple - Use PhpSpreadsheet to write an Excel sheet to a Google Cloud Storage bucket.

            Currently my thought is that the file will need to streamed to the bucket. The other option it seems would be generating it the file in memory and then writing it to the bucket which I feel like could be resource intensive.

            I'm using App Engine with a Standard environment and PHP 7.4.

            To test it out out I've been using the most basic code to make the sheet -

            ...

            ANSWER

            Answered 2022-Jan-17 at 07:36

            Here's a working sample code:

            Source https://stackoverflow.com/questions/70690183

            QUESTION

            How to add custom increment value to database with laravel excel import
            Asked 2021-Dec-19 at 09:34

            i'm using maatwebsite laravel excel to import some data from excel to database. But i want to add some custom ID with incremental value for each row of data. For now, i'm able to import data with some input value form together.

            DataImport file

            ...

            ANSWER

            Answered 2021-Dec-19 at 04:31

            Counting rows will bring you problems whenever you remove a single record from the table: You won't be able to insert new rows if your primary employee_id field has UNIQUE key, or you will start inserting duplicated IDs.

            Generating the ID in PHP isn't my recomendation either since you could face integrity problems if two records are trying to be stored simultaneously.

            I would use the default model's model_id field with autoincrement to make sure that I won't have problems with id assignation, and inmediatly after saving the record I would update the id for the employee_id field which can be also keyed as "primary" in order to be indexed and accessed efficiently.

            For example:

            Source https://stackoverflow.com/questions/70408699

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install PhpSpreadsheet

            You can download it from GitHub.
            PHP requires the Visual C runtime (CRT). The Microsoft Visual C++ Redistributable for Visual Studio 2019 is suitable for all these PHP versions, see visualstudio.microsoft.com. You MUST download the x86 CRT for PHP x86 builds and the x64 CRT for PHP x64 builds. The CRT installer supports the /quiet and /norestart command-line switches, so you can also script it.

            Support

            Read more about it, including install instructions, in the official documentation. Or check out the API documentation. Please ask your support questions on StackOverflow, or have a quick chat on Gitter.
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/PHPOffice/PhpSpreadsheet.git

          • CLI

            gh repo clone PHPOffice/PhpSpreadsheet

          • sshUrl

            git@github.com:PHPOffice/PhpSpreadsheet.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link