Is there any debugger for Google Ads-scripts?
I write my first *.gs
file of Google Ads-script.
Is there any IDE or environment where I can add breakpoints or see the variables state?
I saw only logger printing, but that's not efficient to work with.
I have tried @Andrew's reply, but didn't manage:
You can place dots in next to the line numbers and then click on the little bug icon, like displayed on this image.
This will open this debug screen:
I meant google-ads-script not google-apps-script. Fixed the tags. Where do you run this from?
Ah, never worked with Google Ads script, but this might still work as they are also .gs files. I always run this by opening a Google Spreadsheet and going to Extra > Script Editor. But you can simply reach it at script.google.com.
Also remember to click the debug icon, not the run icon (the button that looks like a bug, not the play button)
you can use this function.
For example: MyLogger("test");
function MyLogger(s,d=true,w=800,h=400,t=5) { const cs=CacheService.getScriptCache(); const cached=cs.get("Logger"); const ts=Utilities.formatDate(new Date(), SpreadsheetApp.getActive().getSpreadsheetTimeZone(), "MM|dd|HH:mm:ss") if(cached) { var v=Utilities.formatString('%s<br />[%s] - %s',cached,ts,s); }else{ var v=Utilities.formatString('[%s] - %s',ts,s); } cs.put("Logger",v,t); //allows logging without displaying. if(d) { const a='<br /><input type="button" value="Exit" onClick="google.script.host.close();" />'; const b='<br /><input type="button" value="Exit" onClick="google.script.host.close();" /><br />'; SpreadsheetApp.getUi().showModelessDialog(HtmlService.createHtmlOutput(b+v+a).setWidth(w).setHeight(h), 'My Logger'); } }(To view logs open spreadsheet with your script)
not sure what's missing: added your method (see original post text).
Cannot call SpreadsheetApp.getUi() from this context.