Cannot instance GC.Spread.Excel.IO

Posted by: leif on 22 May 2020, 3:26 am EST

    • Post Options:
    • Link

    Posted 22 May 2020, 3:26 am EST - Updated 11 January 2024, 5:40 am EST

    I am currently evaluating the SpreadJS libraries.

    Following several tutorials and samples i must admit that i just cannot create an instance of GC.Spread.Excel.IO. Am i doing something wrong? Or is ExcelIO not free for evaluation?

             
    
    In head:
        <link href="node_modules/@grapecity/spread-sheets/styles/gc.spread.sheets.excel2013white.css" rel="stylesheet" type="text/css" />
        <script type="text/javascript" src="node_modules/@grapecity/spread-sheets/dist/gc.spread.sheets.all.min.js"></script>
        <script type="text/javascript" src="node_modules/@grapecity/spread-excelio/dist/gc.spread.excelio.min.js"></script>
    
    
    
    In window.onload handler:
    
    // simply works
    var workbook = new GC.Spread.Sheets.Workbook(document.getElementById("ss"));
                
    // cannot get this to run
    var excelIO = new GC.Excel.IO();
     
    
  • Posted 22 May 2020, 3:29 am EST

    var excelIO = new GC.Spread.Excel.IO();
    

    does not work either:

    Cannot read property ‘IO’ of undefined

  • Posted 26 May 2020, 1:31 am EST

    Hi Leif,

    Using new GC.Spread.Excel.IO(); to instantiate and use excelio is the correct way. Also you have added the proper references so there shouldn’t be any issues.

    Could you share a sample replicating the issue so that we could further investigate itit? We tried to create one but were unable to replicate the issue, following is the sample we used:

    https://codesandbox.io/s/spread-js-starter-dinkj?file=/src/index.js

    Regards

    Sharad

  • Posted 26 May 2020, 1:49 am EST

    Hello Sharad,

    thanks for the working example. I got my code running re-typing it from scratch. I could not find any problem, though. So probably it was a hidden typo… or maybe the import order does matter… or…?

    Anyways: works now.

  • Posted 26 May 2020, 4:01 pm EST

    We are glad that the issue is resolved now.

    Yes, the import order does matter but in the code snippet you shared, the files were already referenced in the correct order i.e first the gc.spread.sheets.all.min.js file and then gc.spread.excelio.min.js file so the file order isn’t the issue here, as you mentioned most probable cause could be hidden typo.

  • Posted 2 March 2021, 10:00 pm EST

    I am getting the same error on react. Any solution…?

  • Posted 15 March 2021, 7:07 pm EST

    Hi Tushar,

    Could you please share a small sample that replicates the issue so that we could investigate it further and assist you accordingly. You may also check the sample that we used for testing and modify it to replicate the issue.

    sample: https://codesandbox.io/s/silly-christian-8vqdb

    regards

    Avinash

  • Posted 26 May 2021, 7:04 pm EST

    I was using react and the issue was resolved after I changed my import to

    
    import * as Excel from "@grapecity/spread-excelio";
    let excelIo = new Excel.IO();
    
    
  • Posted 21 June 2021, 2:57 am EST

    Hi Tushar,

    We are glad to know that the issue has been resolved. Feel free to revert back if you have any further queries regarding this issue.

    Regards,

    Avinash

Need extra support?

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

Learn More

Forum Channels