Hey folks, I’m stuck with a Google Apps Script issue. I made a script to change a file’s status in a spreadsheet from “past due” to “ready.” It’s supposed to work when users click a button in an email modal.
The email sends fine and the modal shows up, but clicking “yes” doesn’t update the spreadsheet. I added some console logs, but nothing seems to appear. It’s like the JavaScript isn’t running at all.
What’s odd is that the innerHTML changes when I click “yes,” yet no update occurs. I suspect the problem might lie in the setDocumentAsReady()
function, since logging the document string shows it as undefined, indicating that the frontend may not be passing the file information properly.
I’ve tried clicking “yes” in the modal and running the script again, but the spreadsheet still doesn’t update. Any ideas on what might be causing this?
I’ve dealt with similar frustrations using Google Apps Script. One thing that helped me was implementing a try-catch block in the setDocumentAsReady() function to catch and log any errors. This way, you can see if there’s an exception being thrown that’s preventing the spreadsheet update.
Also, make sure your script is deployed as a web app with the correct settings. I once spent hours debugging only to realize my deployment settings were off. Check that it’s executing as you (the owner) and that it has access to the spreadsheet.
Lastly, have you verified the spreadsheet ID and sheet name in your script? I’ve been bitten by copy-pasting the wrong ID before. If all else fails, try creating a minimal test case with just the core functionality to isolate the issue. Good luck!
hey zoeStar, sounds like a tricky one! have u checked if the script has proper authorization to edit the spreadsheet? sometimes permissions can be wonky. also, maybe try adding more detailed logs throughout ur code to pinpoint where it’s breaking. good luck troubleshooting!
I encountered a similar issue with Google Apps Script recently. The problem might be related to how you’re executing the script from the email modal. Make sure you’re using Google’s HTML Service correctly for the modal and that your client-side JavaScript is properly communicating with the server-side functions. Also, double-check that your spreadsheet ID and range in the setDocumentAsReady() function are correct. If the document string is undefined, you might need to review how you’re passing that parameter from the frontend to the backend. Consider using Logger.log() instead of console.log() for more reliable debugging in Apps Script.