enuchi / React-Google-Apps-Script

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.
MIT License
1.31k stars 169 forks source link

[Help needed] - How to use scriptlets? #226

Open mohdabidansari opened 1 month ago

mohdabidansari commented 1 month ago

Tried using scriplets in my frontend code but the transformed code resulted in errors.

Code const SHEET_ID = JSON.parse('<?= JSON.stringify(activeSheetId) ?>'); console.log({ SHEET_ID });

Error when running the app Uncaught SyntaxError: missing ) after argument list (at userCodeAppPanel:3:6838)

enuchi commented 1 month ago

Scriptlets aren't supported here.

mohdabidansari commented 1 month ago

So what's the workaround? Is there any other solution apart from making a request sing serverFunctions when the app loads?

enuchi commented 1 month ago

See https://github.com/enuchi/React-Google-Apps-Script/issues/209#issuecomment-1962322152