Is there a way to prevent obfuscation for easier debugging?

418 views
Skip to first unread message

Ellen Spertus

unread,
Jun 13, 2022, 8:11:21 PM6/13/22
to Google Apps Script Community
I am working on a Google Sheets Editor Add-On that is currently bound to a spreadsheet. I like to use the Chrome developer tools, including the debugger. I have noticed that sometimes it is easy to view my code and step through in the debugger. Other times, it is obfuscated and not debuggable. Is there any way to prevent obfuscation?

Typically the way I get to my source code is:
  1. Open the sidebar in the bound spreadsheet through the Chrome Extensions menu.
  2. Open Developer Tools (Control-Shift I).
  3. Click on a sidebar button to run my code.
  4. See a link to my code in a console.log() message or an error.
  5. Click on the link.
Clicking on the link takes me to the Sources tab, where I see either my source code or the obfuscated version.

Thank you.

Ellen

Clark Lind

unread,
Jun 14, 2022, 10:14:29 AM6/14/22
to Google Apps Script Community
I don't think there is a way to stop the obfuscation as that is how Google sandboxes the code. But you should be able to deobfuscate the code
using the second tool on this page to Decode it: https://www.online-toolz.com/tools/text-unicode-entities-convertor.php

Scroll down a little to the  Decode/Unescape Unicode Entities

Ellen Spertus

unread,
Jun 14, 2022, 1:30:48 PM6/14/22
to Google Apps Script Community
Thank you for replying.

I don't think there is a way to stop the obfuscation as that is how Google sandboxes the code.

I wish I could figure out why it sometimes leaves the code unobfuscated, assuming it's not random.

But you should be able to deobfuscate the code
using the second tool on this page to Decode it: https://www.online-toolz.com/tools/text-unicode-entities-convertor.php

Unfortunately that won't help me step through it in the debugger.

Ellen
Reply all
Reply to author
Forward
0 new messages