{"id":19651724,"url":"https://github.com/tanaikech/getedittype","last_synced_at":"2025-04-28T16:31:45.610Z","repository":{"id":79705763,"uuid":"191117131","full_name":"tanaikech/GetEditType","owner":"tanaikech","description":"GetEditType is a GAS library for retrieving the edit types of the OnEdit event trigger of Spreadsheet using Google Apps Script (GAS).","archived":false,"fork":false,"pushed_at":"2021-03-22T05:50:26.000Z","size":5,"stargazers_count":13,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-07-06T03:04:11.753Z","etag":null,"topics":["developer-tools","gas-library","google-apps-script","google-spreadsheet","library","spreadsheet","trigger"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tanaikech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-06-10T07:16:41.000Z","updated_at":"2023-08-26T18:48:51.000Z","dependencies_parsed_at":"2023-05-14T20:30:15.450Z","dependency_job_id":null,"html_url":"https://github.com/tanaikech/GetEditType","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tanaikech%2FGetEditType","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tanaikech%2FGetEditType/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tanaikech%2FGetEditType/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tanaikech%2FGetEditType/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tanaikech","download_url":"https://codeload.github.com/tanaikech/GetEditType/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224124895,"owners_count":17259746,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["developer-tools","gas-library","google-apps-script","google-spreadsheet","library","spreadsheet","trigger"],"created_at":"2024-11-11T15:07:41.981Z","updated_at":"2024-11-11T15:07:42.983Z","avatar_url":"https://github.com/tanaikech.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GetEditType\r\n\r\n\u003ca name=\"top\"\u003e\u003c/a\u003e\r\n[![MIT License](http://img.shields.io/badge/license-MIT-blue.svg?style=flat)](LICENCE)\r\n\r\n\u003ca name=\"overview\"\u003e\u003c/a\u003e\r\n\r\n# Overview\r\n\r\n**GetEditType is a GAS library for retrieving the edit types of the OnEdit event trigger of Spreadsheet using Google Apps Script (GAS).**\r\n\r\n\u003ca name=\"description\"\u003e\u003c/a\u003e\r\n\r\n# Description\r\n\r\nIn the case that the OnEdit event trigger (simple and installable triggers) is used at Spreadsheet, when users manually edited the cell of Spreadsheet, the trigger is fired. At this time, there is the case that I want to know the edit type. For example, I would like to know about the following edit types.\r\n\r\n1. Empty cell was edited\r\n2. Cell with a value was overwritten by a value.\r\n3. Value of cell with a value was removed.\r\n4. Value was added by the copied-down action.\r\n5. Value of the clipboard was directly pasted to a cell.\r\n6. Cell was moved.\r\n\r\nAbove situations will also occur at the multiple cells.\r\n\r\nThese situations might be modified by Google's update. So I created this as a library. By this, when the specification was modified by the update, users and I can use the latest specification by updating the library.\r\n\r\n# Library's project key\r\n\r\n```\r\n13DgweRAOSLMaRiAVcOIYAwoUmsAIrRW_DcfKchwaHJrLP3H-MdcENzZr\r\n```\r\n\r\n\u003ca name=\"howtoinstall\"\u003e\u003c/a\u003e\r\n\r\n# How to install\r\n\r\nIn order to use this library, please install this as a library.\r\n\r\n1. [Install GetEditType library](https://developers.google.com/apps-script/guides/libraries).\r\n   - Library's project key is **`13DgweRAOSLMaRiAVcOIYAwoUmsAIrRW_DcfKchwaHJrLP3H-MdcENzZr`**.\r\n\r\n\u003ca name=\"usage\"\u003e\u003c/a\u003e\r\n\r\n# About scopes\r\n\r\nThis library doesn't use any scopes.\r\n\r\n# Usage\r\n\r\nAfter this library was installed to the container-bound script of Spreadsheet, you can use the following sample script. This sample script can be used for the simple OnEdit event trigger and installable OnEdit event trigger.\r\n\r\n**When you use this library, please edit a cell at Spreadsheet. By this, the event object is returned and this library returns the result using the event object.**\r\n\r\n## For simple trigger\r\n\r\n```javascript\r\nfunction onEdit(e) {\r\n  var res = GetEditType.Do(e);\r\n  Logger.log(res);\r\n}\r\n```\r\n\r\n## For installable trigger\r\n\r\n```javascript\r\nfunction onEdit_sample(e) {\r\n  var res = GetEditType.Do(e);\r\n  Logger.log(res);\r\n}\r\n```\r\n\r\n\u003e When you want to use the installable trigger, generally, please don't install the trigger to the funciton of `onEdit()`. Because when the OnEdit event trigger is installed to `onEdit()`, the trigger is run 2 times for the simple trigger and installable trigger. Please be careful this. [Ref](https://gist.github.com/tanaikech/88f7fd5ed14da5e9afde18310da61cb5)\r\n\r\n## Returned value\r\n\r\nThis library is returned the following values as an object.\r\n\r\n| editCell           | type                         | description                                                                                                 |\r\n| :----------------- | :--------------------------- | :---------------------------------------------------------------------------------------------------------- |\r\n| MULTIPLE           | REMOVE_VALUES                | Values of multiple cells were removed.\u003cbr\u003eEmpty values were pasted.                                         |\r\n| MULTIPLE           | PUT_VALUES_TO_MULTIPLE_CELLS | Values were put to multiple cells.\u003cbr\u003eCopied down was run for multiple cells.\u003cbr\u003eCells were moved.          |\r\n| SINGLE             | PUT_VALUE                    | Empty cell was edited.\u003cbr\u003eValue of the clipboard was directly pasted to a cell.                                                                                      |\r\n| SINGLE             | OVERWRITE_CELL               | Cell with a value was overwritten by a value.                                                               |\r\n| SINGLE             | REMOVE_VALUE                 | Value of cell was removed.\u003cbr\u003eEmpty value was pasted.\u003cbr\u003eValue of empty cell was removed.                   |\r\n| SINGLE             | OTHER                        | Value of the clipboard was directly pasted to a cell.\u003cbr\u003eCopied down was run for a cell.\u003cbr\u003eCell was moved. |\r\n| SINGLE\u003cbr\u003eMULTIPLE | UNKNOWN                      | This is the unknown edit type. If you can report this situation, I would like to update this library.       |\r\n\r\n- About range, source and so on, please directly retrieve them from the event object.\r\n\r\n## References\r\n\r\n- [Simple Triggers](https://developers.google.com/apps-script/guides/triggers/#onedite)\r\n\r\n- [Installable Triggers](https://developers.google.com/apps-script/guides/triggers/installable)\r\n\r\n- [Event Objects](https://developers.google.com/apps-script/guides/triggers/events#edit)\r\n\r\n- [Stackoverflow: google script detect empty cell after edit](https://stackoverflow.com/q/51548360)\r\n\r\n- [Stackoverflow: How to make the onEdit() event object e work when copying and pasting values into blank cells or non-blank cells in Google Sheets?](https://stackoverflow.com/q/56445944)\r\n\r\n- [Stackoverflow: google script detect empty cell after edit — Take 2](https://stackoverflow.com/q/58477852)\r\n\r\n---\r\n\r\n\u003ca name=\"licence\"\u003e\u003c/a\u003e\r\n\r\n# Licence\r\n\r\n[MIT](LICENCE)\r\n\r\n\u003ca name=\"author\"\u003e\u003c/a\u003e\r\n\r\n# Author\r\n\r\n[Tanaike](https://tanaikech.github.io/about/)\r\n\r\nIf you have any questions and commissions for me, feel free to tell me.\r\n\r\n\u003ca name=\"updatehistory\"\u003e\u003c/a\u003e\r\n\r\n# Update History\r\n\r\n- v1.0.0 (June 10, 2019)\r\n\r\n  1. Initial release.\r\n\r\n- v1.0.1 (October 25, 2019)\r\n\r\n  1. Updated: [This answer](https://stackoverflow.com/a/58499090) was reflected.\r\n\r\n[TOP](#top)\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftanaikech%2Fgetedittype","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftanaikech%2Fgetedittype","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftanaikech%2Fgetedittype/lists"}