Discussions

Expand all | Collapse all

SheetsJS imported into Quick Base

  • 1.  SheetsJS imported into Quick Base

    Posted 02-07-2019 03:37
    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.  RE: SheetsJS imported into Quick Base

    Posted 02-07-2019 12:00
    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
    });




  • 3.  RE: SheetsJS imported into Quick Base

    Posted 02-07-2019 14:31
    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.