fromFile method not working and not returning any error.

0 Answers 134 Views
Spreadsheet
Jed
Top achievements
Rank 1
Iron
Jed asked on 13 Jan 2023, 08:04 PM

I have the following code that uses the upload control to take a spreadsheet from our end user and uploads it and then parses it out into our objects.

var workbook = new kendo.spreadsheet.Workbook({});

workbook.fromFile(file).then(function() { Do lots of things; });

I have had zero issues with this block for the most part. However one of our end users has tried to upload a file and they are running into issues. When I debug the code it hits the fromFile, and then goes right past the then. I had multiple breakpoints inside the then, and none of them were being hit. In my last attempt I let it run for almost an hour before I killed it. I tried wrapping it in a try catch to see if it was erroring out and nothing. I tried to upload the file on the demo for the api (https://docs.telerik.com/kendo-ui/api/javascript/ui/spreadsheet/methods/fromfile) and it loads fine there. 

I am at a loss and would love some insight. I have attached the spreadsheet that is causing issues hoping that someone can shed some light on it for me.

Georgi Denchev
Telerik team
commented on 18 Jan 2023, 11:01 AM

Hi, Jed,

Could you check and see which version of Kendo UI you're using? If it is an old one, could you try with one of the later releases to see if that makes a difference?

Additionally, could you verify that all of the necessary scripts are included in the correct order?

<script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
<script src="https://kendo.cdn.telerik.com/2023.1.117/js/jszip.min.js"></script>
<script src="https://kendo.cdn.telerik.com/2023.1.117/js/kendo.all.min.js"></script>

The jszip script must be added before the kendo.all script.

Best Regards,

Georgi

Jed
Top achievements
Rank 1
Iron
commented on 20 Jan 2023, 04:37 PM

Kendo UI v2021.3.1109

We are in the process of applying the updates to see if that helps anything. Originally we didn't have the jszip before the all (it was right after)., when I swapped them to the order you requested it didn't make any impact.

Jed
Top achievements
Rank 1
Iron
commented on 23 Jan 2023, 07:32 PM

We upgraded to v2023.1.117 and the problem still persists. It is just with that single file and I can't for the life of me figure out why.
Georgi Denchev
Telerik team
commented on 25 Jan 2023, 11:27 AM

Hi, Jed,

I've tested several different approaches using the provided file, however it is always loading as expected.

What happens if you try to copy and paste the data from that SpreadSheet into a brand new one and then you attempt to upload the new Excel file?

What about moving the file to a different location on your system? The fact that is working when using the API example and not locally makes me think that there could be some system or server setting that blocks the upload altogether.

Finally, is it possible for you to extract the logic that breaks and create a small sample project with it? If I can reproduce the issue on my end, I should be able to figure out what's happening and provide you with some more concrete answers.

Best Regards,

Georgi

Jed
Top achievements
Rank 1
Iron
commented on 27 Jan 2023, 08:19 PM

When the cells with data are copied to a new sheet or a new workbook they work fine. Moving the file shouldn't impact anything since it is where I upload all of my other files from (local drive). 

 

I am sure if I had the time I could move the logic into a new  project, but I am going to guess that it would work in that scenario since it works everywhere else. Is what I was really hoping for was a way to debug into the whole process so I could see where it is looping infinitely.  As I previously stated this seems to be a one off problem and we haven't had any other issues with the process. The client wants me to exhaust all options before I say 'This is just an odd isolated incident'.

Georgi Denchev
Telerik team
commented on 01 Feb 2023, 09:24 AM

Hi, Jed,

You can download the source code of the entire library from your downloads page:

Inside, you'll see the src/js folder. You can copy that folder into your project and then load the modules.

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="https://kendo.cdn.telerik.com/2022.3.1109/styles/kendo.default-v2.min.css"/>
    <script src="/js/jquery.js" type="module"></script>
    <script src="/js/kendo.all.js" type="module"></script>
    <script src="https://kendo.cdn.telerik.com/2023.1.117/js/jszip.min.js"></script>
</head>

<body>
    <input id="file" type="file" />
    <div id="spreadsheet"></div>
    <script type="module">
        $("#spreadsheet").kendoSpreadsheet();

        $("#file").on("change", function () {
            var spreadsheet = $("#spreadsheet").data("kendoSpreadsheet");
            spreadsheet.fromFile(this.files[0]);
        });
    </script>
</body>

</html>

This will enable you to debug the unminified version of the scripts and step through each method.

Still, if copying the data to a new sheet resolves the problem, the current sheet might be corrupt.

Best Regards,

Georgi

No answers yet. Maybe you can help?

Tags
Spreadsheet
Asked by
Jed
Top achievements
Rank 1
Iron
Share this question
or