Problem importing xlsx file - Incorrect file format

Posted by: i201624446 on 20 June 2019, 2:34 am EST

  • Posted 20 June 2019, 2:34 am EST

    Hello team!

    I’m trying to read a .xlsx file from a test server and I get the error “Incorrect file format”. I followed the following tutorial https://www.grapecity.com/blogs/how-to-importexport-excel-files-using-javascript-and-spread-sheets

    My page is located on a github page:

    https://gricardov.github.io

    When I add data to the table and press “Generar excel” (generate excel), it should read a template, modify it and download it. It all works when I start a local server on my computer, but not on github/heroku server. Please help me.

    This is my code:

    function leerPlantilla() {
        var workbook = new GC.Spread.Sheets.Workbook(document.getElementById("excel"));
    
        return new Promise((resolve, reject) => {
    
          var excelUrl = "plantillas/formatoGlassgowSimple.xlsx";
    
          var oReq = new XMLHttpRequest();
          oReq.open('get', excelUrl, true);
          oReq.responseType = 'blob';
          oReq.onload = function () {
            
            var blob = oReq.response;
            excelIO.open(blob, (json) => {
              jsonData = json;
              workbook.fromJSON(json);
              workbook.setActiveSheet("1");
              resolve(workbook);
            }, function (message) {
              console.log(message);
              reject('No se pudo leer')
            });
          };
          oReq.send(null);
    
        })
    
      }
    

    Thanks in advance

  • Posted 21 June 2019, 2:40 am EST

    Hi,

    For deploying the application online, you need to have a valid distribution key embedded into your application. Please make sure that a valid distribution key is embedded in your application.

    If the issue persists for you, please share a small sample replicating the issue so that we could further investigate the issue.

    Regards

    Sharad

Need extra support?

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

Learn More

Forum Channels