How do you pass back a custom error message from google apps scripts?

后端 未结 3 1618
甜味超标
甜味超标 2020-12-16 13:15

When running a google apps script from a google spreadsheet, if one of the google apis is used incorrectly a red \"butterbar\" error is shown at the top of the spreadsheet.

3条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-16 13:37

    You can try to have a look to the Base class that gives you the possibility to add alert box or other dialogs to interact with the user of your application if it is bound to a Spreadsheet (for example msgBox()). For a DocumentApp use the Ui class to interact with its interface.

    I never tried but if you use a try...catch structure with a throw statement it can also work.

    Cheers

    Nicolas

提交回复
热议问题