Upload excel file to Javascript NOT WORKING, NOT PROCESSING

Basically, my code is should allow the user to upload a data file (excel csv file), then use the data inside that uploaded file to create and plot charts and graphs. I have successfully created the upload file button, but once I upload the csv file, nothing is being drawn. I have a feeling there is something wrong in “this.handleFile = function(file)”, and the file is not being read or processed properly, but I’m not sure exactly what it is that’s causing this error.

This is the error I am getting on console:
enter image description here

FYI: The drawing and plotting part of the code is all working fine, since I have tested it out on another file, where the data file being used was a very specific File.

this.setup = function() 
  {
      this.fileInput = createFileInput(this.handleFile.bind(this));
      this.fileInput.position(width/2, 10);
        
      if (!this.loaded) 
      {
          console.log('Data not yet loaded');
          return;
      };

    this.select = createSelect();
    this.select.position(1080,42);

    var sd = this.data.columns;
    for(var i = 1; i < 8; i++)
        {
            this.select.option(sd[i]);
        };
  };
 
    
this.handleFile = function(file) 
{
    if (file.type === 'text') 
    {
        this.data = loadTable(file.data, 'csv', 'header', 
                              function(table) 
                              {
            self.loaded = true;
        });
    }
    return;
};

I’ve played around with the parameters of loadTable, removed the last parameter after header, I’ve tried calling setup in this.handleFile to let the code run again from setup after the data file is loaded.

The excel file NEEDS to be read and the data inside processed to draw things