infostreams / excel-merge Goto Github PK
View Code? Open in Web Editor NEWA PHP library to merge two or more Excel files into one
License: MIT License
A PHP library to merge two or more Excel files into one
License: MIT License
Hi,
I came across this tool when I was working with https://github.com/PHPOffice/PhpSpreadsheet on an excel macro enabled file. In my case I need to populate the macro sheet with data, but I found the macro logic is getting stripped out when I write to the file.
In my case, i have a .xlsm file with ten sheets which contains macro logic. I have a second file with ten sheets which contains data. I was hoping to use the code below to merge the content of the two files
$files = array("./admin/BHAA.Race.Master.xlsm", "/admin/clean-data-file.xlsx"); $merged = new ExcelMerge\ExcelMerge($files); $merged->download("my-filename.xlsm");
but what I am noticing is that the downloaded file contains 20 sheets. Could you advise how i might amend the existing code to merge the sheet content, such that i have ten sheets with data and macros. I'm happy to fork the repo and submit a push request but before I start I'd like to confirm this is in keeping with the vision you have for this tool.
Regards,
Paul
First off, thanks for the great library for merging excel. I'm currently using PHP 5.3.3 on a CentOS 6 box and I get a fatal error when trying to merge 2 excel files regarding using DOMNodeList as an array in the Tasks/Styles.php file.
If I change all $elems[0] to $elems->item(0), I no longer get a fatal error and the excel generates successfully. Could you review the fix and see if you can apply it to your Master release. I want to continue and use your repository.
Hi,
The directory name of $where is lost when using 'save' function.
You should keep PATHINFO_DIRNAME when defined.
Regards
Hi @infostreams ,
I'm just getting the following ErrorException : ZipArchive::extractTo(): Invalid or uninitialized Zip object
at /vendor/infostreams/excel-merge/ExcelMerge.php:208
Do you have any thoughts why it's taking place? Thanks.
Hello, I'm trying to merge a .xlsm and a .xlsx files together. The first one is my "template" file with only a couple of macros, the second one only have 3 lines to test. I'm unable to figure the issue. Maybe can you take a look?
Thanks in advance.
SharedStrings.php
public function merge($zip_dir = null) {
.....
$target->documentElement->setAttribute('uniqueCount',count($shared_strings)); // <-- update uniqueCount
$target->save($target_filename);
return $mapping;
}
Styles.php
styles from the first sheet are lost
***** Styles_new.php
$new_id = count($defined_styles);
$defined_styles[$new_id] = array( // <-- add new element
"node" => $style,
***** STYLES_OLD.PHP
$new_id = count($defined_styles);
$defined_styles[$id] = array( // <-- owerwrite exist element
"node" => $style,
Please advice.
[ErrorException]
Undefined offset: 164
Here is trace:
() at C:\vendor\infostreams\excel-merge\Tasks\Styles.php:175
Illuminate\Foundation\Bootstrap\HandleExceptions->handleError() at C:\vendor\infostreams\ex
cel-merge\Tasks\Styles.php:175
ExcelMerge\Tasks\Styles->rewriteCells() at C:\vendor\infostreams\excel-merge\Tasks\Styles.p
hp:51
ExcelMerge\Tasks\Styles->merge() at C:\vendor\infostreams\excel-merge\ExcelMerge.php:134
ExcelMerge\ExcelMerge->mergeWorksheets() at C:\vendor\infostreams\excel-merge\ExcelMerge.ph
p:55
ExcelMerge\ExcelMerge->addFile() at C:\vendor\infostreams\excel-merge\ExcelMerge.php:40
I am using PHP 7.0.4 with Laravel 5.2
Hello,
When I try to merge my file I get this error ...
Can you tell me why?
thank you in advance
fist.xlsx
seconde.xlsx
Hi,
When merging several groups of small files one after the others it tries to create a temporary folder working_dir with an existing name based on date+hour+minute+second (not yet deleted?) so it crashes. It works better when adding uniqid() in the name.
Regards
Hi,
I've just discovered your lib after running into memory issues while merging XSLX files.
All works great ONLY with the modification done on PR #13 . However, this change is only available on your master branch. Could you create a tag with this modification to obtain a stable version via composer install ?
When merging excel with images, it doesn't add the images.
Tested on php7.0 and ubuntu 1604
best regards
I am facing issue with time delay for creating and merging .xlsx file. My search for fast merging ended here but now i don't know how to integrate our class with my laravel ?
Hi everyone,
There a chance to make this package support php 8.1?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.