How to import dataframe-js into Google App Script?

824 views Asked by At

I have used the http link to import the package:

var d3Url = "https://gmousse.github.io/dataframe-js/dist/dataframe.js";
eval(UrlFetchApp.fetch(d3Url).getContentText());

But when I do const df = new DataFrame(company_df[1], company_df[0]), it gives a Reference Error: DataFrame is not defined.

I have also tried to put var DataFrame = dfjs.DataFrame; at the top. But, no luck.

How can I correctly import the package?

1

There are 1 answers

0
JOHN On

Try to put

var Url = "https://gmousse.github.io/dataframe-js/dist/dataframe.min.js";
eval(UrlFetchApp.fetch(Url).getContentText());

in the same file of var DataFrame = dfjs.DataFrame;

It works although I don't know the reasons.