Web Design. Web Development. Web Hosting.
0 items

XLSX To CSV Conversion PHP (Fast & Efficient)

Need some help? We are here for you!

We have a very friendly service - Come and chat to us and let us know what you need, we work for an hourly fee and can also provide you a no obligation quote and begin work immediately in most cases. Click "Request Support" or use our Live Chat.

Request support

There are various ready-made and well maintained PHP libraries for converting/processing XLSX – and by no means are these libraries bad, they have a ton of features for creating/editing and reading XLSX files. Two libraries I have tried personally are PHPEXCEL or the newer library PHPSpreadsheet.

So what is the problem with these? They cater for a whole bunch of things, making them useful for various tasks, however the problem lies with footprint and processing times when you are looking to read medium to large XLSX files -they are prone to eating resources, taking too long or timing out completely.

When looking for straight up conversion and/or processing XLSX for various tasks such as feeds, these libraries are not optimized and are not optimized for the task, even failing completely if the XLSX is large enough.

 

Super Fast XLSX to CSV that can handle huge files

Our XLSX to CSV conversion script is purpose built for converting XLSX files directly to CSV, making them easy to process with built in PHP CSV functions. It is not only much faster at converting XLSX to CSV – it can handle absolutely HUGE XLSX files without using up huge amounts of server resources, meaning you do not have to be operating a massive server.

We have created our own functions that perform the conversion with the best performance possible, allowing conversions of large XLSX files super-fast and memory efficient,  our script can reliably, quickly and effortlessly convert XLSX files for you allowing your application to process data as you see fit.

Whats more our script allows you to process multiple sheets in an XLSX by allowing you to define which sheet to read out of the file.

Our script comes raw and is usable for any projects you desire, no code obfuscation, no encryption, you buy it, use it in your projects whether business or personal. All we ask if you be fair if your using this script a lot, consider paying us more in the future if your feeling generous.

How it works

its easy really, no complicated classes, our script is just a function in a file – you can embed it into your object model structure or use the function raw if you choose. Here is an example call to our function:

<?php
 /*
 You can use XLSX2CSV very easily as shown below, just change the paths to the correct paths you need.
 
 */
 $xlsx_file = '/path/to/file.xlsx';
 $xlsx_unzip_path = '/unpack/here/'; //make sure this is a unique empty folder (especially if using the cleanup)
 $csv_file = '/path/to/result.csv';
 $sheet = 1;
 $throttle = false; //you can set this to ie. 100 to fetch only 100 rows
 $cleanup = true; //if you dont want to cleanup all the junk you can turn this off.
 
 xlsx2csv($xlsx_file, $xlsx_unzip_path, $csv_file, $sheet, $throttle, $cleanup);
?>

 

 

Latest Updates

22/05/20 – 2.4.0 – Fixed an major issue where processing could get stuck in an infinite loop causing maxout of resources.

12/05/20 – 2.3.0 – Added ability for the processor to parse date columns from excel to actual string dates in the csv instead of EPOCH time.

17/02/20 – 2.2.0 – Fixed an issue where some XLSX files would sometimes handle blank cells incorrectly shifting data to the left in the CSV and causing data misalignment.

22/08/19 – 2.1.0 – Fixed a small bug from dropbox editor and how it saves the sharedstrings causing issues with the parser.

3.9 7 votes
Article Rating
Need some help? We are here for you!

We have a very friendly service - Come and chat to us and let us know what you need, we work for an hourly fee and can also provide you a no obligation quote and begin work immediately in most cases. Click "Request Support" or use our Live Chat.

Request support
Author: Dean WilliamsProfessional PHP Web Developer with expertise in OpenCart Web Development, WordPress Web Development, Bespoke Systems - also a seasoned Linux Server Administrator.


Subscribe
Notify of
4 Comments
Inline Feedbacks
View all comments
Henning
4 years ago

This script consists of just a few lines of complicated code. But it does exactly what it should do!

Tom Sharp
4 years ago

This saved my life!! I have tried all sorts of XLSX libraries, but they would all consume too much memory, timeout or just not convert to CSV properly. I was dubious about purchasing this (being a developer myself) but it was my last effort before spending weeks trying to build my own. This works flawlessly. Thank you!

ervin howell
3 years ago

can we use it with laravel 5.8??



Share this page..

Let's begin your journey...

Get in touch us now to begin your journey to having a beautifully crafted mobile responsive website. If you're still unsure what we could do for you then take a look at our why us page which includes reviews, or take a look at our portfolio.

We can work on improving existing websites or craft a new stylish website making your business stand out.

You could always catch us by email, telephone, Skype or live chat to us below.


    4
    0
    Would love your thoughts, please comment.x
    ()
    x