Exporting workbook to Excel gives "Incorrect file format."

Posted by: frederik.beaudry on 27 November 2020, 1:12 am EST

  • Posted 27 November 2020, 1:12 am EST


    I've tried just about everything.

    I am trying to export my workbook to excel using excel IO and I keep getting an "Incorrect file format." error. I am in development and do not posses a license yet.

    The application is in Angular 11 and using the following packages.

    "@grapecity/spread-excelio": "^13.2.3"
    "@grapecity/spread-sheets": "^13.2.3"
    "@grapecity/spread-sheets-angular": "^13.2.3"

    Here is the code I use to export the workbook.

    I've also included screenshots of the function being called in debug.

    public exportExcelFile(workbook: GC.Spread.Sheets.Workbook, filename: string): void {
    const workbookJson = workbook.toJSON();
    const stringifiedWorkbookJson = JSON.stringify(workbookJson);

    const instance = new Excel.IO();

    instance.save(stringifiedWorkbookJson, (blob) => {
    }, (e) => {
    if (e.errorCode === 1) {


  • Replied 1 December 2020, 12:40 am EST


    We are unable to replicate the issue at our end. Please refer to the attached sample that we used for testing and if the issue persists please share a small sample that replicates the issue so that we could investigate it further and assist you accordingly.

  • Replied 19 May 2021, 6:05 pm EST

    I am facing the same error. I am using the below code.

    saveExcel(e: any) {
    let spread = this.spread;
    let excelIo = new GCExcel.IO();

    let fileName = this.exportFileName;
    let password = this.password;
    if (fileName.substr(-5, 5) !== '.xlsx') {
    fileName += '.xlsx';

    let json: any = spread.toJSON();

    // here is excel IO API
    excelIo.save(json, function (blob: any) {
    saveAs(blob, fileName);
    }, function (e: any) {
    // process error
    }, { password: password });


  • Marked as Answer

    Replied 20 May 2021, 6:03 pm EST


    Since we are unable to replicate the issue at our end. Could you please share a small sample that replicates the issue so that we could investigate it further?.

    Further, you may also refer to the following sample that we used for testing.


  • Replied 25 August 2021, 8:19 pm EST


    I have same problem with exporting XLS.

    I am working with 14.1.5 version grapecity.

    I found couple topic about this problem.

    I coped my file object to the Example:

    And there my object works correct. BUT in my app this object not work.

    Export function:

    My imports:
  • Replied 25 August 2021, 10:00 pm EST


    I fixed problem with the error: "Incorrect file format."

    You have to import file:
    <script src="https://www.grapecity.com/spreadjs/demos/spread/source/js/FileSaver.js" type="text/javascript"></script>

  • Replied 26 August 2021, 7:53 pm EST


    We are glad to know that the issue has been resolved. Feel free to contact us back if face any issues.

  • Replied 26 August 2021, 9:15 pm EST

    Could you Add information about the FileSaver.js to the documentation?
  • Replied 30 August 2021, 8:14 pm EST


    FileSaver is not required to export the workbook as Excel it is a third-party library that is used to save the blob as the file so we could not add it in our docs. The Excelio.save method returns a blob(binary large objects), You could do whatever you want with that blob such as store it on the server.

    The exporting functionality does not depend upon the filesaverjs. Further, the error you were getting was because you were using the saveAs method and not importing the fileSaver.js.

    I hope this clarifies the issue.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels