Giter Site home page Giter Site logo

Do you intend to add Web app functionality too via app script in this project? Thanks for this great project! about react-google-apps-script HOT 7 CLOSED

enuchi avatar enuchi commented on July 29, 2024
Do you intend to add Web app functionality too via app script in this project? Thanks for this great project!

from react-google-apps-script.

Comments (7)

tino-brst avatar tino-brst commented on July 29, 2024 3

Just wanted to add another Thanks for this great project!, super useful resource! 🙌 💯

from react-google-apps-script.

enuchi avatar enuchi commented on July 29, 2024 2

Yes, this repo already should support web apps, with little change.

You need to add the doGet function and return the html file:

// src/server/ui.js
...
export const doGet = () => HtmlService.createHtmlOutputFromFile('dialog-demo-bootstrap');

Expose that function as a public function in the server entrypoint:

// src/server/index.js
...
global.doGet = publicUiFunctions.doGet;

Assuming you have everything else running properly, deploy the code (npm run deploy).

Publish the web app from the script editor (instructions here https://developers.google.com/apps-script/guides/web#deploying_a_script_as_a_web_app) and open the web app.

Screen Shot 2020-08-23 at 3 10 17 AM

Local development with hot reloading works too.

from react-google-apps-script.

enuchi avatar enuchi commented on July 29, 2024 1

Hi @soql101 , have you tried updating here? Although not sure why you would need this.

SpreadsheetApp.getActive()

from react-google-apps-script.

enuchi avatar enuchi commented on July 29, 2024

@kk-ssc curious what you or others use web apps for.

from react-google-apps-script.

kk-ssc avatar kk-ssc commented on July 29, 2024

That helped. Thank you, I am planning on creating a personal to do list project :)

from react-google-apps-script.

soql101 avatar soql101 commented on July 29, 2024

@enuchi Hi , I followed step as above but I am getting error 'ScriptError: Exception: Please select an active sheet first.' i am not able to set activate sheet for web app till now I come up with SpreadsheetApp.openById('1mDmI_iPp0RYXG5Os7F.......').setActiveSheet('Sheet1');
also wondering in which function I need to add this . Your help really appreciated

from react-google-apps-script.

soql101 avatar soql101 commented on July 29, 2024

@enuchi thanks for your input.

If someone land on same question while working with Web App, here is fix

In sheets.js
Replace all SpreadsheetApp.getActive() with SpreadsheetApp.openById('<sheetId>')

Example
const getSheets = () => SpreadsheetApp.getActive().getSheets();
replace with

const getSheets = () =>SpreadsheetApp.openById('<sheetId>').getSheets();

Heads up : setActiveSheet arrow function will not work in web app
why ?

In order for something to be active, it must be open in the browser.
The code:
SpreadsheetApp.getActive().
Gets a Google Sheet that is already open in the browser.
But
SpreadsheetApp.openById(SHEET_ID)
Doesn't open up a Sheet in the browser.
You can't activate something that isn't open in the browser.
The activate() method will never work with SpreadsheetApp.openById(SHEET_ID)

export const setActiveSheet = sheetName => {

from react-google-apps-script.

Related Issues (20)

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.