Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/07/26 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Il n'y a pas l'information dont j'ai besoin","missingTheInformationINeed","thumb-down"],["Trop compliqué/Trop d'étapes","tooComplicatedTooManySteps","thumb-down"],["Obsolète","outOfDate","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Mauvais exemple/Erreur de code","samplesCodeIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 2025/07/26 (UTC)."],[[["\u003cp\u003eSpreadsheetTriggerBuilder facilitates the creation and customization of triggers specific to Google Spreadsheets.\u003c/p\u003e\n"],["\u003cp\u003eIt offers methods to set triggers for various events, such as changes in content or structure (\u003ccode\u003eonChange()\u003c/code\u003e), edits (\u003ccode\u003eonEdit()\u003c/code\u003e), form submissions (\u003ccode\u003eonFormSubmit()\u003c/code\u003e), and spreadsheet opening (\u003ccode\u003eonOpen()\u003c/code\u003e).\u003c/p\u003e\n"],["\u003cp\u003eEach trigger specification method returns a builder object, enabling chained configurations for flexibility and conciseness in trigger setup.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003ecreate()\u003c/code\u003e method finalizes the trigger definition and returns a Trigger object, instantiating the trigger for execution based on the specified event.\u003c/p\u003e\n"]]],[],null,["SpreadsheetTriggerBuilder\n\nBuilder for spreadsheet triggers. \n\nMethods\n\n| Method | Return type | Brief description |\n|-----------------------------------|--------------------------------------------------|--------------------------------------------------------------------------------------------|\n| [create()](#create()) | [Trigger](/apps-script/reference/script/trigger) | Creates the trigger and returns it. |\n| [onChange()](#onChange()) | [SpreadsheetTriggerBuilder](#) | Specifies a trigger that will fire when the spreadsheet's content or structure is changed. |\n| [onEdit()](#onEdit()) | [SpreadsheetTriggerBuilder](#) | Specifies a trigger that will fire when the spreadsheet is edited. |\n| [onFormSubmit()](#onFormSubmit()) | [SpreadsheetTriggerBuilder](#) | Specifies a trigger that will fire when the spreadsheet has a form submitted to it. |\n| [onOpen()](#onOpen()) | [SpreadsheetTriggerBuilder](#) | Specifies a trigger that will fire when the spreadsheet is opened. |\n\nDetailed documentation \n\n`create()` \nCreates the trigger and returns it.\n\nReturn\n\n\n[Trigger](/apps-script/reference/script/trigger) --- The created trigger.\n\n*** ** * ** ***\n\n`on``Change()` \nSpecifies a trigger that will fire when the spreadsheet's content or structure is changed.\n\n```javascript\nconst sheet = SpreadsheetApp.getActive();\nScriptApp.newTrigger('myFunction').forSpreadsheet(sheet).onChange().create();\n```\n\nReturn\n\n\n[SpreadsheetTriggerBuilder](#) --- a builder for chaining\n\n*** ** * ** ***\n\n`on``Edit()` \nSpecifies a trigger that will fire when the spreadsheet is edited.\n\n```javascript\nconst sheet = SpreadsheetApp.getActive();\nScriptApp.newTrigger('myFunction').forSpreadsheet(sheet).onEdit().create();\n```\n\nReturn\n\n\n[SpreadsheetTriggerBuilder](#) --- a builder for chaining\n\n*** ** * ** ***\n\n`on``Form``Submit()` \nSpecifies a trigger that will fire when the spreadsheet has a form submitted to it.\n\n```javascript\nconst sheet = SpreadsheetApp.getActive();\nScriptApp.newTrigger('myFunction')\n .forSpreadsheet(sheet)\n .onFormSubmit()\n .create();\n```\n\nReturn\n\n\n[SpreadsheetTriggerBuilder](#) --- A builder for chaining.\n\n*** ** * ** ***\n\n`on``Open()` \nSpecifies a trigger that will fire when the spreadsheet is opened.\n\n```javascript\nconst sheet = SpreadsheetApp.getActive();\nScriptApp.newTrigger('myFunction').forSpreadsheet(sheet).onOpen().create();\n```\n\nReturn\n\n\n[SpreadsheetTriggerBuilder](#) --- a builder for chaining"]]