Comments (9)
It's hard to say what is wrong with it, but it looks like it is trying to access something that doesn't exist. I wrote some code that first checks if the thing exists. It should make this error go away, but I'm not sure if it will then produce a correct Excel file βΒ for that I need more information, such as which two files you're trying to merge.
Please let me know if this fixes your problem.
from excel-merge.
Thanks for your fast response.
I will give you two sample of files in the next couple days.
from excel-merge.
Did the new version not fix the problem?
On 23 Jul 2016, at 06:00, minkbear [email protected] wrote:
Thanks for your fast response.
I will give you two sample of files in the next couple days.β
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
from excel-merge.
Ahhh... Sorry my mistake. I will try a new release and back to you.
from excel-merge.
No error anymore but there is no file output as expected when calling save.
My parameter path is:
"C:\test\storage\report/sm\sm_25597213.xlsx"
from excel-merge.
Ok, that doesn't make any sense. Can you just attach or make available the files you're trying to merge, along with the code you've written to do that? I can have a look after the weekend.
On 23 Jul 2016, at 07:20, minkbear [email protected] wrote:
No error anymore but there is no file output as expected when calling save.
My parameter path is:
"C:\test\storage\report/sm\sm_25597213.xlsx"
β
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
from excel-merge.
please download sample files here: https://dl.dropboxusercontent.com/u/17863424/excel_merge_2.zip
$files = [
'C:\test\storage\report/sm\sample_1.xlsx',
'C:\test\storage\report/sm\sample_2.xlsx'
];
$merged = new ExcelMerge($files);
$filename = $merged->save('c:\test\storage\report/sm\test_merge.xlsx');
Thank you.
from excel-merge.
Hi! I could reproduce your issue, but I couldn't fix it. I could work around it, though.
I suspect the issue is that these are files that are created by a 'real' version of Excel, and this library was originally written to deal with Excel files generated by PHPExcel. I don't know why it doesn't seem to work properly with normal Excel files, but apparently they are slightly different and that confuses this library.
Nevertheless, if you want to work around this issue and get a mostly functioning, mostly correct output file:
First, do
composer require PHPOffice/PHPExcel
Then, use the following code instead of the code you provided
require_once("vendor/autoload.php");
$files = [
'data/sample_1.xlsx',
'data/sample_2.xlsx'
];
foreach ($files as $i=>$f) {
$objReader = PHPExcel_IOFactory::createReader("Excel2007");
$objPHPExcel = $objReader->load($f);
// Write the file
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, "Excel2007");
$filename_new = $f . ".new.xlsx";
$objWriter->save($filename_new);
$files[$i] = $filename_new;
}
$merged = new ExcelMerge\ExcelMerge($files);
$filename = $merged->save('test_merge.xlsx');
Excel still gives a warning when opening the output file, but it contains all the information and seems to be mostly correct upon first glance.
I'm closing this issue because the README clearly states that the library has a problem with 'native' Excel files, that I don't know the reason, and that I don't have proper time to look into it. If you know why it's failing, or if you figure out how to fix it, please contribute to the development of this library and open a pull request. Thanks!
from excel-merge.
Thank you much for your response.
from excel-merge.
Related Issues (13)
- Cannot use object of type DOMNodeList as array HOT 2
- Errors HOT 4
- Support PHP 8.1 HOT 1
- Add PR #13 to a new tag HOT 3
- Merged file is broken HOT 1
- Question - Merging sheet content with the same name HOT 3
- Directory name lost HOT 1
- Temporary folder not unique HOT 1
- Bug image HOT 3
- how can i integrate this with my laravel 5.2 ? HOT 2
- Getting ZipArchive::extractTo(): Invalid or uninitialized Zip object HOT 3
- Excel with images HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from excel-merge.