Can no longer produce PDF from Google Sheets spreadsheet for some of the users

I was having this exact problem. After some debugging I saw that my URL was being created incorrectly.

My code was nearly identical to yours. Where I found the culprit was the following line:

var url_base = theSpreadSheet.getUrl().replace(/edit$/,'');

This was not actually clearing out the ‘edit’ to the end of the line like it had for years. I cannot say why this is, but the proof was in the logs. So, instead I crafted the url by hand:

var   url="https://docs.google.com/spreadsheets/d/"+SpreadsheetApp.getActiveSpreadsheet().getId()+"https://stackoverflow.com/";

This seemed to solve the problem. This is not a perfect futureproof resolution, because if Google changes how the URLs are crafted, this will fail. But it works for now.

I hope this helps. You can send the url your code is creating to logs and check them to see if you have the same issue I did.

Leave a Comment

bahis casinocanlı casino siteleritürkçe altyazılı pornocanlı bahis casino