Giter Site home page Giter Site logo

enuchi / react-google-apps-script Goto Github PK

View Code? Open in Web Editor NEW
1.3K 23.0 167.0 3.1 MB

This is your boilerplate project for developing React apps inside Google Sheets, Docs, Forms and Slides projects. It's perfect for personal projects and for publishing complex add-ons in the Google Workspace Marketplace.

License: MIT License

JavaScript 53.34% HTML 13.64% CSS 6.17% TypeScript 24.78% PowerShell 2.07%

react-google-apps-script's Issues

Dist folder not populating

I've followed the steps exactly, the only change I've made is in package.json is to SET NODE_ENV to work on Windows. I run npm run setup and then npm run deploy and the only thing in my dist folder is my appsscript.json file.

Screenshot_1

React hot reload

Hi again, I love that you've got hot reload built in, but I'm seeing on area where I wonder if I'm doing something wrong, or if it could be improved.

When I save a change to a file, the addon does indeed hot reload, however the react app seems to lose most of its state. Sometimes this is fine, but other times it really slows down development requiring me to re-create the current state (eg use my addon to do a bunch of stuff) to get back to where I was before the reload.

I believe react-hot-loader and react fast refresh https://reactnative.dev/docs/fast-refresh are meant to solve this, but I hit different issues with each and couldn't get them working as expected with the addon.

Have you explored this at all? Thanks!

Alex

Multiple html templates

Hello,

As configured in webpack.config, this setup will only have dialog. What if I want to have sidebar? I can copy tasks, but for more files, it would be difficult and not productive.

React Developer Tools Chrome Extension

Hello,
I was wondering it there was a way to use the Rect Dev Tools Chrome extension on dialogs and sidebars created with this project.
When I try to do so, I get the message "This page doesn’t appear to be using React" (screenshot).
Thank you,
Guido

Typescript support

Do you intend to add Typescript to this project? clasp already supports this already.

Thanks for this great project!

Test client in local

Is there a way to test the client in local?

I would like to design the UI, modify css locally to save time. This would save a lot of turn around time.

Support ES2020

Hey @enuchi`, when using Nullish coalescing operator, the build fails with the following error. Am not sure which webpack config to change in this regard. Could you please guide.

Module parse failed: Unexpected token (90:35)
File was processed with these loaders:
 * ./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
|     allowClear: true,
|     treeNodeFilterProp: "searcher"
>   }, (initialValues.metrics.items ?? []).map(group => /*#__PURE__*/React.createElement(TreeSelect.TreeNode, {
|     selectable: false,
|     value: group.group,

Transpiled .html files are too large

Hi @enuchi ,

Recently I noticed an issue, the transpiled .html files are too large.

With a simple React component like your sample dialog, the output file is more than 250KB.

In my project, although I've just started with some logic, the output file is 1.8 MB.

I'm not sure if this is normal with Babel, but at the end of my project, the output file might be 10 MB or even 20MB I think.

Another issue is with a large file like this, when you open it by the browser (script.google.com), the browser will hang up (not responding).

Do you have these issues when you were developing your addon before? And what might be the solution?

Thanks.

react-router BrowserHistory and HashHistory support

Currently if a user wants to use routers for a GAS web app, these is only support for MemoryRouter. This is because GAS' web app sandboxed environment restricts access to APIs BrowserHistory and HashHistory depend on (ex. window.history).

I would like to write a Google Apps Script-specific implementations of BrowserHistory and HashHistory for web app projects by taking advantage of the following APIs: google.script.history and google.script.url.

@enuchi if I did this would you merge those implementations into this project so they are accessible to those interested in using routers in GAS web apps?

Server-side functions slugginesh problem

First of all, congratulations for this great package: it is really helpful being able to use React on Google Apps Scripts!

I have installed the demo project, but when using the Sheet Editor, it takes a really long time (>5s) to load the sheets list; here's a screencast of the issue. The same happens with my own scripts.

Is the delay expected?

Thank you,
Guido

Strange issue... ERR_CONNECTION_REFUSED...can't pin down why this issue is happening.

80% of the time, my app works fine. However, sometimes when I need to redeploy or npm run start again, something breaks and I receive these errors when opening up the app:

GET http://localhost:8097/ net::ERR_CONNECTION_REFUSED
react-redux.min.js:9 Uncaught TypeError: Cannot read property 'unstable_batchedUpdates' of undefined at react-redux.min.js:9
Io {message: "There was an error during the transport or process…this request. Error code = 10, Path = /wardeninit", name: "TransportError", stack: "TransportError: There was an error during the tran…/js/2633236535-warden_bin_i18n_warden.js:195:263)"}

The function to open the modal runs successfully, but then these errors occur and only a blank modal page is shown.

The strange thing is that usually some combination of re-deploying, emptying the cache, signing out of my Google account and back in, will fix this issue. However, not all of these work as the solution 100% of the time. It's so weird. Sometimes I try all of them and nothing has worked, but when I try again later it does work. Then the next time I re-deploy the issue comes up again.

I'm so curious what this issue might be related to.

I am using redux, and the 2nd error points to an error with redux. However, I think it's more likely that somehow the app is just not loading correctly when I run the deploy script and that is what is causing the redux error. When I look at the code in the script editor, it looks normal.

I'll also add that this error doesn't happen EVERY time I re-deploy. Sometimes I can go from local development, deploy, and then the error will happen when I run npm start. Then sometimes I'm stuck with this error in the deployed version and when I run npm run start it will actually fix the issue. It's SO WEIRD.

Has anyone else encountered anything like this? Not expecting anyone to know the answer but if you have any ideas on anything I should test or investigate please let me know. I don't even know where to start.

error in ./src/server/index.js

I have followed the steps to deploy the project and on the last step i run npm run deploy. I have tried several times and I end up with an Error. Module build failed (from ./node_modules/babel-loader/lib/index.js)
Error: cannot find module '@babel/compact-data/corejs3-shipped-proposals'

I cannot seem to get passed this. DO i need to manually configure the dependencies?

Unsafe attempt to initiate navigation for frame with origin 'https://docs.google.com' from frame with URL 'https://localhost:3000/taxonomytool-impl.html'. The frame attempting navigation of the top-level window is sandboxed, but the flag of 'allow-top-navigation' or 'allow-top-navigation-by-user-activation' is not set.

Hi!

I am trying to add a link for users to give feedback on my gsheets web app. However I keep getting the error Unsafe attempt to initiate navigation for frame with origin 'https://docs.google.com' from frame with URL 'https://localhost:3000/taxonomytool-impl.html'. The frame attempting navigation of the top-level window is sandboxed, but the flag of 'allow-top-navigation' or 'allow-top-navigation-by-user-activation' is not set. whenever I click on the link.

I understand I just need to set the 'allow-top-navigation-by-user-activation' sandbox attribute on the iframe, but am struggling how to do so from this library since we never declare the iframe itsself anywhere. When I ctrl+f for iframe, I only see one tag and it looks like its in the dev index.js.

I suspect I can modify this code in the server ui.js file to add the attribute, but looks like I can't call setAttribute here. Anyone have any ideas?

  const html = HtmlService.createHtmlOutputFromFile('taxonomytool')
    .setWidth(900)
    .setHeight(900);
  SpreadsheetApp.getUi().showModalDialog(html, 'Taxonomy Builder');
};

Error in published addon

Everything works fine in dev but after publishing my addon I'm getting this error: We're sorry, a server error occurred while reading from storage. Error code PERMISSION_DENIED.

I was able to eventually fix this buy moving some of the functions from the generated code to the top of the file. I put these three functions at the top:

function onOpen() {
  SpreadsheetApp.getUi().createAddonMenu().addItem("Launch", "openSidebar").addToUi();
}
function onInstall(e) {
  onOpen(e);
}
function openSidebar() {
  var html = HtmlService.createHtmlOutputFromFile("main").setTitle("Causal");
            SpreadsheetApp.getUi().showSidebar(html);
}

and removed them from the global.*.

Any idea why this is happening? I'd prefer to fix this properly instead of manually rewriting the generated code.

Building doesn't use CDN

Building doesn't seem to source available packages via cdn.

Eg. I ran the boilerplte with no modifications. Here is the transpiled main.html - https://pastebin.com/u5N8kmWE.

  • It has a lot of inlined js

  • Build inlines "react-addons-css-transition-group" js rather than calling via cdn

Am I missing something here? Please clarify

Install npm packages for serverside

How can I install node packages like axios and make it run on the server side of Google App script?

So far I am able to install packages for the client side. How do I install packages for the server side?

Syntax error in main.gs

Hello I pulled the repo and tried running without any modifications and am hitting an issue when running npm run start.

Syntax error: SyntaxError: Invalid or unexpected token line: 370 file: main.gs

I took a look at main.js and it looks like webpack is generating invalid javascript. Curious to see if anyone else is hitting this.

Line 370:

/******/ });ls || {};\n\n//# sourceURL=webpack:///./src/client/dialog-demo/styles.css?");

Localhost refused to Connect

I followed the steps listed and see the below error when trying to access any page.

image

i'm running the application on Windows and updated package.json to use the correct syntax in scripts. What am I doing wrong?

Permission Denied

I can only run my app in incognito mode, where only one user is logged in. If there are more than one gmail session, then I get the following error.

ScriptError: We're sorry, a server error occurred while reading from storage. Error code PERMISSION_DENIED.

I know this is a common issue, but I dont see this error messages with few Add Ons that I install from the store. Any idea on how to handle they are handling the multi session problem?

appendRow's input type should be any[] typed in google-apps-script.spreadsheet.d.ts

Although in the goolge app script document mention that the input type is object , in typescript string is not cast able to object type.
This is causing the input of appendRow with string type got flagged by typescript

appendRow's input type should be any[] typed in google-apps-script.spreadsheet.d.ts as per @types/google-apps-script

https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/google-apps-script/google-apps-script.spreadsheet.d.ts
line 1814 (spreadsheet) and 1633 (sheet) :
appendRow(rowContents: any[]): Sheet;

"npx clasp push" doesn't execute correctly

Hi!

I've run all the commands from the readme, and everything worked properly except for the last step: "npm run deploy". The error has to do with clasp, but I don't understand how to fix it. Here's the error when it runs "npx clasp push":

  code: 400,
  errors: [
    {
      message: "Syntax error: SyntaxError: Unexpected token 'export' line: 32 file: src/client/server.gs",
      domain: 'global',
      reason: 'badRequest'
    }
  ]
}

Thank you for your help!

Had an issue setting NODE_ENV on windows - "ENOENT: no such file or directory, open 'dist\appsscript.json'"

Hey again @enuchi,

I had the opportunity to upgrade my project recently to the newest version you've published. However, even using the starter demo you provided, I was having some issues with the commands:

"build:dev": "NODE_ENV=development webpack",
"build": "NODE_ENV=production webpack",

This was likely due to being on Windows, but even so, I had no luck adding "SET " before "NODE_ENV". I ended up finding the below module and was able to fix the issue by following their instructions.

Not sure if you need to update the project, I just wanted this to be here if someone else has the same problem.

module: https://www.npmjs.com/package/cross-env
Original Error Message: ENOENT: no such file or directory, open 'dist\appsscript.json'
Likely issue: Due to being on Windows

Does this repo work with Form's addon sidebar?

In the description, you wrote that:

Use this demo project as your boilerplate React app for HTML dialogs in Google Sheets, Docs and Forms.

So will it work with Sidebar?

And if yes, can you please give an example code that shows how to make a sidebar multipages addon?

Thank you very much.

Typescript- web api

Nice work on typescript. :)

I tried use typescript with web api on client side code, but got complaint of
Cannot find name 'window'.ts(2304)

I tried set tsconfig below but still the same.
{
"compilerOptions": {
"lib": [ "es2015", "es6", "DOM" ],

"noImplicitAny": true,
"module": "commonjs",

"types": ["gas-types-detailed"],
"jsx": "react",
"esModuleInterop": true

},

}

Am I missing some configuration ?

How to run as a Google App Script Library?

This project seems to work fine when I publish the code to a script attached to a specific Google Sheet, but when I convert it to a Library by following these docs, basically by creating a version, then in another Google Sheet editing it's script to add the library I just created (also documented in that link).

When I do that and I update the function name argument to include the library id, e.g 'openSidebar' -> 'libraryId.openSidebar, it opens the sidebar as usual, but when I try to call my 'server' functions, it says serverFunctions[functionName] is not a function`.

Is this a bug? or is there a configuration I can set to make so that my script is Library compatible?

Not returning spreadsheet data from the server

Urgent ... Please help, trying to set-up a COVID-19 search facility for a charity for self-employed people.

I want to get all the data from a spreadsheet, I've added a handler in sheet-editor.js

  const getSheetContentsHandler = () => {
    console.log('getSheetContents', getSheetContents);
    getSheetContents()
      .then(data => {
        console.log('got data', data);
        setData(data);
      })
      .catch(alert);
  };

which calls a method in sheets-utilities.js

const getSheetContents = () =>
  SpreadsheetApp.openById('my-spreadsheet-id')
    .getActiveSheet()
    .getDataRange()
    .getValues();

The utility function works fine and I can use Logger.log to see it returns the correct spreadsheet data.
But the promise response in my handler function triggers with data = null
I'm not quite sure what's going on under the hood here.
The response from .getValues() in the utility seems to be synchronous, so I don't understand why the promise would be resolving to null

(the getSheetsData() method works fine and returns the names of the sheets in the spreadsheet and I can add sheets too)

Run on local webserver AND still deploy as app script?

I've been using this to try and rewrite my Google Docs side panel add-on (previously a lot of JQuery) that has multiple pages. However, testing the add-on gets pretty tedious when you have to deploy it and go rerun the add-on every time you make a change. I was hoping there was a way to use the normal "Create React App" starter project and it's ability to run on a local web server (npm start) where you can see updates immediately while maintaining the ability to publish to the App Script project. I don't mind faking the data for local purposes while I work on the front end so I can make sure nothing breaks.

Any suggestions?

Unable to deploy the repo

I follow the instruction in ReadMe, everything is working fine before I deploy the repo
npm run deploy

However, the script does not updated and google sheet does not have add-in installed, but the command line interface shows that I have already pushed files to google script project.
file-uploaded
EmptyScript

(node:824760) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'map' of undefined

Ran npm run deploy, however, the process failed during clasp push. Please see the terminal readout below.

Note: npm run build then cd dist and clasp push was successful.

Versions:

npm 6.13.0
npx 10.2.0
clasp 2.3.0
(env) C:\repos\React-Google-Apps-Script>npm run deploy

> [email protected] deploy C:\repos\React-Google-Apps-Script
> npm run build && npx clasp push


> [email protected] build C:\repos\React-Google-Apps-Script
> webpack --mode production

clean-webpack-plugin: C:\repos\React-Google-Apps-Script\dist has been removed.
info: WebpackClean - removed C:\repos\React-Google-Apps-Script\dist\main.js
info: WebpackClean - DONE
Hash: 8275ad7f3cbb95ed67b597f8d734ad1bb48e9ad5a8394b4d67e47bdd7fbd8d3d07ff36c0eb366916
Version: webpack 4.35.3
Child COPY APPSSCRIPT.JSON:
    Hash: 8275ad7f3cbb95ed67b5
    Time: 917ms
    Built at: 11/17/2019 10:04:08 AM
              Asset       Size  Chunks             Chunk Names
    appsscript.json  204 bytes          [emitted]
            main.js   1.09 KiB       0  [emitted]  main
    Entrypoint main = main.js
    [0] ./appsscript.json 204 bytes {0} [built]
Child CLIENT - main dialog:
    Hash: 97f8d734ad1bb48e9ad5
    Time: 9723ms
    Built at: 11/17/2019 10:04:17 AM
        Asset     Size  Chunks                    Chunk Names
    main.html  252 KiB          [emitted]  [big]
      main.js  252 KiB       0  [emitted]  [big]  main
    Entrypoint main [big] = main.js
     [7] ./src/client/styles.css 1.06 KiB {0} [built]
    [13] (webpack)/buildin/global.js 472 bytes {0} [built]
    [27] ./node_modules/css-loader!./src/client/styles.css 1.9 KiB {0} [built]
    [31] ./src/client/main.jsx + 4 modules 3.67 KiB {0} [built]
         | ./src/client/main.jsx 204 bytes [built]
         | ./src/client/server.js 636 bytes [built]
         |     + 3 hidden modules
        + 28 hidden modules

    WARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
    This can impact web performance.
    Assets: 
      main.js (252 KiB)
      main.html (252 KiB)

    WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
    Entrypoints:
      main (252 KiB)
          main.js
    

    WARNING in webpack performance recommendations: 
    You can limit the size of your bundles by using import() or require.ensure to lazy load some parts of your application.
    For more info visit https://webpack.js.org/guides/code-splitting/
    Child html-webpack-plugin for "main.html":
         1 asset
        Entrypoint undefined = main.html
        [0] ./node_modules/html-webpack-plugin/lib/loader.js!./src/client/dialog-template.html 412 bytes {0} [built]
        [2] (webpack)/buildin/global.js 472 bytes {0} [built]
        [3] (webpack)/buildin/module.js 497 bytes {0} [built]
            + 1 hidden module
Child CLIENT - about sidebar:
    Hash: a8394b4d67e47bdd7fbd
    Time: 6703ms
    Built at: 11/17/2019 10:04:14 AM
         Asset     Size  Chunks             Chunk Names
    about.html  218 KiB          [emitted]
       main.js  218 KiB       0  [emitted]  main
    Entrypoint main = main.js
     [7] (webpack)/buildin/global.js 472 bytes {0} [built]
     [8] ./src/client/styles.css 1.06 KiB {0} [built]
     [9] ./node_modules/css-loader!./src/client/styles.css 1.9 KiB {0} [built]
    [13] ./src/client/about.jsx + 1 modules 640 bytes {0} [built]
         | ./src/client/about.jsx 205 bytes [built]
         |     + 1 hidden module
        + 10 hidden modules
    Child html-webpack-plugin for "about.html":
         1 asset
        Entrypoint undefined = about.html
        [0] ./node_modules/html-webpack-plugin/lib/loader.js!./src/client/dialog-template.html 412 bytes {0} [built]
        [2] (webpack)/buildin/global.js 472 bytes {0} [built]
        [3] (webpack)/buildin/module.js 497 bytes {0} [built]
            + 1 hidden module
Child SERVER:
    Hash: 8d3d07ff36c0eb366916
    Time: 1836ms
    Built at: 11/17/2019 10:04:09 AM
      Asset     Size  Chunks             Chunk Names
    code.js  5.6 KiB       0  [emitted]  main
    Entrypoint main = code.js
    [0] ./src/server/sheets-utilities.js 1.67 KiB {0} [built]
    [1] ./src/server/code.js 437 bytes {0} [built]
    [2] (webpack)/buildin/global.js 472 bytes {0} [built]
info: WebpackClean - removed C:\repos\React-Google-Apps-Script\dist\main.js
info: WebpackClean - DONE
(node:824760) [DEP0066] DeprecationWarning: OutgoingMessage.prototype._headers is deprecated
? Manifest file has been updated. Do you want to push and overwrite? Yes
Push failed. Errors:
(node:824760) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'map' of undefined
    at C:\repos\React-Google-Apps-Script\node_modules\@google\clasp\src\files.js:350:50
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
(node:824760) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch bl
ock, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:824760) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the N
ode.js process with a non-zero exit code.

Client JS not getting the sheet from serverFunctions.getActiveSpreadsheet()

I added a new function in sheets.js : export const getActiveSpreadsheet = () => SpreadsheetApp.getActiveSpreadsheet();
Defined it globally in index.js: global.getActiveSpreadsheet = publicSheetFunctions.getActiveSpreadsheet;

in my client code I have this:

serverFunctions.getActiveSpreadsheet().then(ss => InsertRow(ss))
       .catch(err => console.log(err));

    function InsertRow(ss) {
        var rowLast = ss.getLastRow();
        ss.insertRowAfter(rowLast);
    }

However I get an error that getLastRow is not a function. In the debugger, ss seems to be an empty object. Shouldn't it be the active sheet returned from the server getActiveSpreadsheet()?

Custom functions support (With auto complete)

Google Apps script support custom functions. (https://developers.google.com/apps-script/guides/sheets/functions). I can include the custom function and assign it to the global scope. The problem with that it will not support auto-complete since webpack stripes of the comments.

Note: Custom functions will appear in this list if their script includes a JsDoc @customfunction tag
Eg:

/**
 * Multiplies the input value by 2.
 *
 * @param {number} input The value to multiply.
 * @return The input multiplied by 2.
 * @customfunction
 */

Not able to use react-router package

I tried to install "react-router" package

And then proceeded with navigation using this package. But that does not work.

For an instance: script_url/home where home is my parameter does not load the component

Update to React 17

Hi @enuchi ,

Do you think one can reasonably migrate to React 17 using your repo?
Are you planning it ?

Thanks

Move focus back to Slides app

Hi,
I'm trying to build a Slides extension with your wonderful Template. Thank you for that.
I am running into an issue. After I execute a serverFunction I would like to move the focus programmatically to the Slides app so that I can have the ability to undo using shortcut(command + z) right away if I need to. I can't find a way to do that.
I am able to do that when I run the below from an extension written directly in Googles Script Editor.
google.script.host.editor.focus()

Any help would be appreciated.

Debug code

Hi!
Thanks for this repo, it helps me a lot.

Now I have a issue, I lost the capability in the google apps script editor to debug the functions. For example, SpreadsheetApp.getActiveSheet() returns null, but the code works if I call the function from the client side.

How you debug your code in this environment?

Listen for spreadsheet events in ui

Is there a proper way to use onSelectionChange or other listeners to update the ui? for example, I want my react app to know when the user selects a new cell, and I want to update my app with the content of that cell.

I am trying to pass my react dispatch method to the onSelectionChange in server functions:

// react app
import React from 'react';
export const initialState = { currentView: 'chatWindow' };
export const GlobalStore = React.createContext(initialState);
export const useGlobalStore = () => React.useContext(GlobalStore);
// server/index.js
import { useGlobalStore } from '../client/screen-app/store';
global.onSelectionChange = e => {
  const { dispatch } = useGlobalStore();
  dispatch({ type: 'row', value: someValue });
};

Thanks for creating this template, it's been great to work with!

using development mode in apps scripts?

hi - everything is working pretty well - great project!

when i push things using 'npm run deploy' (which uses production mode) - everything appears to work fine - although it's difficult to debug because the error messages are quite cryptic in production mode.

so, i've been trying to use the development mode... but when i try to push the development build using npx webpack --mode development && npx clasp push

nothing appears to show up in my google sheet.

anyone know how to push the development version using clasp? this would be really helpful in debugging.

Does this repo work with app script as a standalone app (not using Sheets)?

I've cloned this project looking forward to use it as a AppsScript standalone app, but the repo's setup explains how to start with Sheets... I´ve tried using my AppsScript app's id but when I "run" the project it won't work:

image

Missing ; before statement. (line 5810, file"main")

I didn't install anything yet, using just a fresh clone of the project.

Maybe I'm expecting a feature? what i'm trying is even possible?

Any luck developing with Safari?

Thanks for this library - we're having success using it to build an addon with React. While our addon works in Chrome in development, it doesn't start up in Safari in development (it does work in production though).

I get:

serverFunctions.myFunctionNameHere is not a function.

How to render both sidebar and dialog?

In your example, React app renders a dialog.

I customized code and I can render a Sidebar in Forms addon.

My question is how to render both a dialog and a sidebar?

For example, in Forms Menu, I have 2 items: Get started and About

If I click Get started, the sidebar will be displayed

If I click About, the dialog will be displayed.

At the moment I can't find any way so that React app renders both .html files (sidebar.html and about.html) because React is SPA so there is only one entry point.

Thank you.

Doesn't transpile server code correctly

I think there some incompatibility rising from ES 6/7 code in the /Server/*.js scripts.

I found problems when doing these

1. Using Object.X methods

const testData = {
    11: {
      data: 'item',
      dataType: 'cat1',
    },

    12: {
      data: 'item2',
      dataSourceType: 'cat1',
    }
  };

 const result = Object.values(testData); // ERROR HERE

Error Message

  • GAS Rhino runtime: Cannot find function values in object function Object() { [native code for Object.Object, arity=1] }

  • GAS V8 runtime: No Error

2. Using Classes

// Create Customer class as follows:
export default class Customer {}

// Import the class 
import Customer from './path/to/Customer'; 

// Use the class
var customer = new Customer();
var name = customer.getName();  // ERROR HERE

Error Message

  • GAS Rhino runtime: TypeError: Cannot find function getName in object [object Object].
  • GAS V8 runtime: ScriptError: TypeError: this.getName is not a function

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.