KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

"Exporting to Excel is giving me 'Excel cannot open the file 'TourFinancial.xlsx' " IT works for ALL other reports/exports. It must be the volume #1241

Open paulo opened this topic on on Jan 2, 2020 - 9 comments

paulo commented on Jan 2, 2020

"Exporting to Excel is giving me 'Excel cannot open the file 'TourFinancial.xlsx' because the file format or file extension is not valid. Verify that the file has not been corrupted and that the file extension matches the format of the file. "

I have this working for several other reports, but this one. Query works well in MySQL, and I can export from there to Excel without any issue. Koolreport can present on the screen using a table, but when I am trying to export I get the error above. Note: This export has about 800 rows with about 25 columns. Is there a limit to the export function? VIEW:

  <a href="/report/executeReport/Reporting:TourFinancialsExcel" class="btn btn-primary">Download Excel</a>

  <?php

        Table::create(array(
            "dataSource" => $this->dataStore("TourFinancials"),

        ))
        ?>

Laravel Controller:

  Log::info("AdminReportController:executeReport executing id=".$id);
                $report = new TourFinancials;
                $report->run()->exportToExcel()->toBrowser("TourFinancials.xlsx");
                exit;
class TourFinancials  extends KoolReport
{
    use \koolreport\laravel\Friendship;
    use \koolreport\amazing\Theme;
    use \koolreport\inputs\Bindable;
    use \koolreport\inputs\POSTBinding;
    use \koolreport\excel\ExcelExportable;

    function setup()
    {
        Log::debug("TourFinancials setup" );

        $this->src('mysql')->query(QUERY ENTERED HERE  ")
            ->pipe($this->dataStore('TourFinancials'));

thank you! Paulo

David Winterburn commented on Jan 3, 2020

Hi Paulo,

To test whether volume causes this problem, please try to limit the number of rows and see how export runs.

If volume is indeed the reason, please use a new feature of the Excel package for exporting huge data:

https://www.koolreport.com/docs/excel/export_to_big_spreadsheet/

Let us know the result. Thanks!

Sowmya commented on Jan 3, 2020

I have 13 columns in my Export Excel, but for me also it is showing same error. I am working on with this package from last 1 Month. I changed so many times my code. But same result, Every time. In Forum so many members asked about the same error. By following Tutorial I got the data, according to my seetings

https://www.stellarinfo.com/support/kb/index.php/article/resolve-error-excel-cannot-open-the-file-filename-xlsx

I think it is a bug in Koolreport.

Please solve it as early as possible.

It is very very important feature for my Client, and I have to implement as early as possible.

For this feature only we stopped deployment. Try to understand situation.

paulo commented on Jan 3, 2020

Hi Thanks for the info Sowmya!

@David, you are right, it wasn't the volume. I did limit and also tried with the new class you sent, and got the same error. I followed Sowmya's link and was able to 'open and repair' , it does fix the issue which makes me believe this is a bug with the export function in general. Please let me know what kind of info you would be looking for to help fixing this bug.

Here is the error log after repairing : <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <recoveryLog xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><logFileName>error137560_02.xml</logFileName><summary>Errors were detected in file 'C:\Users\PauloB\Downloads\TourFinancials (7).xlsx'</summary><additionalInfo><info>Excel completed file level validation and repair. Some parts of this workbook may have been repaired or discarded.</info></additionalInfo></recoveryLog>

thanks Paulo

David Winterburn commented on Jan 6, 2020

Hi Paulo,

Please send us your corrupted excel exported file to support@koolphp.net. Thanks!

Sowmya commented on Jan 7, 2020

Hi Paulo,

You got the solution for Export Excel?
paulo commented on Jan 10, 2020

No ! I have sent them an email. No reply yet.

Sowmya commented on Jan 24, 2020

Hi Paulo,

You got the solution for Export Excel?
paulo commented on Jan 24, 2020

NOPE. I did send them the file, but I haven't heard from them yet. @David Winterburn, any update on this ? thanks

Sowmya commented on Jan 25, 2020

NOPE. Same error again and again, Even I changed my code. If any updates, Please let me know. Thank You.

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
bug

Export