SheetsJS imported into Quick Base

  • 0
  • 1
  • Question
  • Updated 2 months ago
  • In Progress
  • (Edited)
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.
Photo of Ryan Stanford

Ryan Stanford

  • 1,014 Points 1k badge 2x thumb

Posted 2 months ago

  • 0
  • 1
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 30,044 Points 20k badge 2x thumb
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
});


Photo of Ryan Stanford

Ryan Stanford

  • 1,014 Points 1k badge 2x thumb
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.
(Edited)