Forum Discussion

RyanStanford1's avatar
RyanStanford1
Qrew Captain
6 years ago

SheetsJS imported into Quick Base

I've  been using Dan Diebolt's IOL technique to infuse my custom JavaScript into a form, and it's worked great in the past.

Issue I'm currently having is that the code that I'm trying to run requires the SheetJS library to be included... I'm having trouble finding the link for this, as the community version is on GitHub, and how the proper way to import/include this library into the code.

I've attempted simple $.getscript()

I've tried to add script tags to the DOM...nothing seems to be working correctly.

2 Replies

  • The IOL is not the problem. You are probably trying to load  xlxs as a global through a <script> tag embedded using $.getScript(). xlxs is written with with module detection logic which will see QuickBase's use of requireJS and consequently load as a requireJS module. You need to do something like this:

    require.config({
      paths: {
        "xlsx": "https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.14.1/xlsx.full.min";
      }
    });
    require(['xlsx'], function(xlsx) {
      console.dir(xlsx)
      //your code here
    });


  • Hey Dan,

    I added this code exactly, wrapping all of my code with it, and it is erroring out. In QB, it is no longer firing the code at all.

    I even took out my custom code and only have in the function a console.log("This is working");

    What am I missing?

    ********Update*******_

    I figured out the error... in the paths argument, it doesn't need the semicolon at the end of the line.

    This works perfectly.