Coder Social home page Coder Social logo

Comments (9)

infostreams avatar infostreams commented on June 6, 2024

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.

minkbear avatar minkbear commented on June 6, 2024

Thanks for your fast response.
I will give you two sample of files in the next couple days.

from excel-merge.

infostreams avatar infostreams commented on June 6, 2024

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.

minkbear avatar minkbear commented on June 6, 2024

Ahhh... Sorry my mistake. I will try a new release and back to you.

from excel-merge.

minkbear avatar minkbear commented on June 6, 2024

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.

infostreams avatar infostreams commented on June 6, 2024

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.

minkbear avatar minkbear commented on June 6, 2024

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.

infostreams avatar infostreams commented on June 6, 2024

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.

minkbear avatar minkbear commented on June 6, 2024

Thank you much for your response.

from excel-merge.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.