Sheetjs is only capable of processing the initial 1000 rows of data

I have successfully integrated sheetjs to import excel files into a database. However, I have encountered an issue where it only imports the first 1000 rows of data.

Here is my code: Whenever a user uploads a file using the input field, a worker is created to handle the reading process. Once the reading is complete, the data is sent via ajax to the PHP import script.

$('#input-excel2').change(function(e){
            var v=Date.now();
            var worker = new Worker("./scripts/parsexlsx2.js?v="+v);
            var data= e.target.files[0];
            var filename= e.target.files[0].name;
            if(filecheck(filename)) {
                worker.postMessage(data);
                $('#loader2').jqxLoader('open');
                worker.onmessage = function(e) {
                    $.ajax({
                            type:"POST",
                            url: "./scripts/import2.php?action=import",
                            data: {data: e.data, datei: filename},
                            datatype: "JSON",
                            success: function(answer) {
                                $('#eventsPanel2').html(answer);
                                $("#input-excel2").val("");
                                getlastuploads();
                            }
                        });
                    worker.terminate();
                    $('#loader2').jqxLoader('close');
                };
            } else {
                $('#eventsPanel2').html("Die Datei "+filename+ " wurde bereits importiert!");
            }
        });

This is the actual read script in the worker:

importScripts('../js-xlsx/dist/xlsx.full.min.js');
onmessage=function(msg) {

var reader = new FileReader();
reader.readAsArrayBuffer(msg.data);
reader.onerror  = function(e) {
    var htmlstr = e.data;
};
reader.onload = function(e) {
    var data = new Uint8Array(reader.result); //reader.result;
    var wb = XLSX.read(data,{type:'array',cellDates:true, cellNF: false, cellText:false});
    var sheetName = wb.SheetNames[0];
    var result = XLSX.utils.sheet_to_json(wb.Sheets[sheetName],{header:1,dateNF:'YYYY-MM-DD"T"hh:mm:ss'});
    postMessage(result);
};
};    

Answer №1

After some investigation, I managed to discover the solution on my own: The issue lied within the PHP script, specifically in the max_input_vars limit set for POST requests. The fix was to serialize the data into a JSON string before sending it via POST.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Is your Jquery validation malfunctioning?

I am currently facing a challenge with required validation on an asp.net page. In order to validate the inputs, I have implemented multiple controls which can be hidden or displayed based on certain conditions. These controls include checkboxlists, dropdow ...

Optimal placement of JavaScript in an Asp.net MVC application with an extensive reliance on partial views

Where is the ideal placement for JavaScript code that is specific to a partial view? For instance, if I have a partial view (loaded via an ajax call) with some divs and I want to convert those divs into an accordion, would it be more advantageous to includ ...

TextGeometry in Three JS is designed to always face the user

Here is the source code I have been working on. My main goal is to make sure that TextGeometry is always facing the camera. Is this possible? Code: var stats; var camera, controls, scene, renderer; init(); render(); functi ...

The jQuery autocomplete feature is malfunctioning, as it is unable to display any search

Creating a country list within an ajax call involves working with an array of objects: $.ajax({ url: '//maps.googleapis.com/maps/api/geocode/json?address=' + zipCode + '&region=AT', type: 'GET', dataType: &apo ...

Is there a way in Vue to efficiently route multiple instances belonging to the same component while ensuring they maintain their individual states?

It's a bit difficult to capture the exact issue in the title. Here is the scenario: // In the main layout page <keep-alive> <router-view /> </keep-alive> // And I have a route { path: "something/:id", name: "someth ...

Develop a dynamic modal feature that allows users to input SQL queries and execute them seamlessly without having to

I need to implement a feature in my web application where users can set the price of an item displayed in an HTML table that is populated from a MySQL database. When a user clicks on a button next to a row, a modal should open with a text input field and a ...

I lingered a moment too long on the left and right buttons of my Carousel

Currently facing an issue with a slideshow feature where the images are not smoothly transitioning when using the left/right buttons. The transition is either delayed, slow, or causes the page to hang. Additionally, after some time, the images automaticall ...

Javascript - Incrementing value upon key press, but limited to occurring only once

I am currently working on a script where I need to increment a variable by 5 each time the up key is pressed. The issue I am facing is that the variable keeps increasing continuously from a single keypress, whereas I want it to increase in steps of 5 (e.g. ...

Conceal the .dropdown-backdrop from bootstrap using solely CSS styling techniques

Is there a way to hide the .dropdown-backdrop element from Bootstrap for a specific dropdown on a webpage using only CSS? I found a solution that involves Javascript, you can view it on JSFiddle here. However, I am hoping to achieve this without relying o ...

Why isn't my state updating with componentDidMount()?

I am currently exploring React and working on creating a view counter for different divs. To achieve this, I require the height and scroll top height of the divs. However, after obtaining these values, I am facing issues when trying to set state with the ...

What is the proper way to create a regex pattern that specifies 'without any spaces'?

I need assistance in creating a regex expression that specifies "and NO whitespaces". I have to incorporate this into the following if statement shown below: $('#postcode').blur(function(){ var postcode = $(this), val = postcode.val(); ...

Is there a way to verify if a button on a form has been clicked in an HTML file and then execute a script in Node.js?

As a newcomer to nodejs, I am currently working on one of my goals which involves sending data to a MySQL database based on the information entered into a form. I am seeking assistance on how to execute a function in nodejs when the button on the form is c ...

Is there a way to separate a string using two different delimiters?

Here is my code snippet : <template> ... <p v-for="club in clubs">{{club}}</p> ... </template> <script> export default { data: () => ({ clubs: '' }), mounted () { let dataClub = "- ...

What is stopping me from adjusting the brightness on my canvas?

When using canvas to adjust the luminosity of an image, everything works fine if the luminosity is only set once. However, when trying to reset the luminosity back to 0, the default image does not appear as expected. Here is the code that calls the effect ...

Error: Undefined object while trying to access 'injection' property

After updating to React 16.x, I encountered the following error: Uncaught TypeError: Cannot read property 'injection' of undefined at injectTapEventPlugin (injectTapEventPlugin.js:23) at eval (index.js:53) at Object.<anonymous> ...

Executing a loop synchronously within an Angular application

I am grappling with Angular as I have an $http request retrieving multiple rows that need to be processed synchronously. The challenge arises when these records must be processed against a local SQLite database on an iOS device, which involves an asynchron ...

One handy feature in PHP or JavaScript allows users to delete items by simply

I'm encountering an issue with removing checked items from the data because my delete button is not included in the for loop that retrieves data from the database. This makes it hard to identify which data needs to be deleted based on its ID. While I ...

Exploring a JSON API structure with the help of jQuery

I am currently exploring the world of JSON API and attempting to extract some data. As a beginner, I find myself struggling to identify the exact value to use. Here is an example of the JSON API I am dealing with: [ {"lang":"english","visual":"<span ...

Having trouble getting rid of the border-bottom?

I have been attempting to customize the appearance of the React Material UI tabs in order to achieve a design similar to this: https://i.stack.imgur.com/tBS1K.png My efforts involved setting box-shadow for the selected tab and removing the bottom border. ...

What is the name of the undefined JSON object and how can I retrieve its parameters?

After sending a request to a web server, I received the following response: The response, when using JSON.stringify, appears as shown below: undefined{\"access_token\":\"Rhazjww5 ...QUiTMVc\",\"token_type\":\"bearer&bs ...