{"id":19651763,"url":"https://github.com/tanaikech/datefinder","last_synced_at":"2025-04-28T16:31:43.831Z","repository":{"id":79705753,"uuid":"237139420","full_name":"tanaikech/DateFinder","owner":"tanaikech","description":"DateFinder is a GAS library for searching the date objects from the cell range on the sheet in the Spreadsheet and retrieving the searched range as the RangeList object using Google Apps Script (GAS).","archived":false,"fork":false,"pushed_at":"2021-03-21T12:59:55.000Z","size":3,"stargazers_count":13,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-05T09:51:08.279Z","etag":null,"topics":["developer","gas-library","google-apps-script","google-spreadsheet","library","search"],"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}},"created_at":"2020-01-30T04:35:01.000Z","updated_at":"2025-02-14T02:39:21.000Z","dependencies_parsed_at":"2023-05-14T20:30:08.377Z","dependency_job_id":null,"html_url":"https://github.com/tanaikech/DateFinder","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%2FDateFinder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tanaikech%2FDateFinder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tanaikech%2FDateFinder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tanaikech%2FDateFinder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tanaikech","download_url":"https://codeload.github.com/tanaikech/DateFinder/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251345981,"owners_count":21574811,"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","gas-library","google-apps-script","google-spreadsheet","library","search"],"created_at":"2024-11-11T15:07:54.938Z","updated_at":"2025-04-28T16:31:43.535Z","avatar_url":"https://github.com/tanaikech.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DateFinder\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**DateFinder is a GAS library for searching the date objects from the cell range on the sheet in the Spreadsheet and retrieving the searched range as the RangeList object using Google Apps Script (GAS).**\r\n\r\n\u003ca name=\"description\"\u003e\u003c/a\u003e\r\n\r\n## Description\r\n\r\nThere is [the Class TextFinder](https://developers.google.com/apps-script/reference/spreadsheet/text-finder) for searching the text from cells of the Spreadsheet using the Google Apps Script. But in this case, the date object in the cell is used as the string. Namely, the values for searching are used as the same with the values retrieved by [`getDisplayValues()`](https://developers.google.com/apps-script/reference/spreadsheet/range#getdisplayvalues). So for example, when there are the date objects in the cells with the various formats, the date cannot be searched by the Class TextFinder. So I created this library. When this library is used, the date objects in the cells can be retrieved by the date object and/or the range between 2 dates.\r\n\r\n# Library's project key\r\n\r\n```\r\n17ghJiHk43mDeFqYYQRc7YMfTRv9hMNk0dkJ2rudZmJUMaopR0gvS9B01\r\n```\r\n\r\n# Methods\r\n\r\n| Methods                   | Description                                      |\r\n| :------------------------ | :----------------------------------------------- |\r\n| [search(object)](#search) | Search date objects and return RangeList object. |\r\n\r\n\u003ca name=\"usage\"\u003e\u003c/a\u003e\r\n\r\n# Usage:\r\n\r\n## 1. Install library\r\n\r\nIn order to use this library, please install this library as follows.\r\n\r\n1. Create a GAS project.\r\n\r\n   - You can use this library for the GAS project of both the standalone type and the container-bound script type.\r\n\r\n1. [Install DateFinder library](https://developers.google.com/apps-script/guides/libraries).\r\n\r\n   - Library's project key is **`17ghJiHk43mDeFqYYQRc7YMfTRv9hMNk0dkJ2rudZmJUMaopR0gvS9B01`**.\r\n\r\n### About scopes\r\n\r\nThis library use the scope of `https://www.googleapis.com/auth/spreadsheets`.\r\n\r\n\u003ca name=\"search\"\u003e\u003c/a\u003e\r\n\r\n## 2. Method: `search`\r\n\r\nIn this method, the date objects in the cells are searched from the sheet of Spreadsheet.\r\n\r\n### Sample script 1\r\n\r\n```javascript\r\nvar spreadsheetId = \"###\";\r\nvar sheetName = \"Sheet1\";\r\n\r\nvar sheet = SpreadsheetApp.openById(spreadsheetId).getSheetByName(sheetName);\r\nvar range = sheet.getRange(\"A1:C10\");\r\nvar from = new Date();\r\nfrom.setDate(from.getDate() - 1);\r\nvar to = new Date();\r\n\r\nvar object = { sheet: sheet, range: range, from: from, to: to };\r\nvar res = DateFinder.search(object);\r\nres.getRanges().forEach(function(range) {\r\n  Logger.log(\"%s, %s\", range.getA1Notation(), range.getValue());\r\n});\r\n```\r\n\r\n- In this sample script, the ranges and values of date from \"now\" to \"now - 1\" day are retrieved from the range of \"A1:C10\" on \"Sheet1\" in the Spreadsheet of \"###\".\r\n\r\n- **`DateFinder.search(object)` returns [RangeList](https://developers.google.com/apps-script/reference/spreadsheet/range-list).**\r\n\r\n- If `var object = { sheet: sheet, range: range, from: from};` is used, all date values after `from` are retrieved.\r\n\r\n- If `var object = { sheet: sheet, range: range, to: to};` is used, all date values before `to` are retrieved.\r\n\r\n- If `var object = { sheet: sheet, range: range, date: date};` is used, date values which are the same with `date` are retrieved.\r\n\r\n- If `var object = { sheet: sheet, date: date};` is used, date values which are the same with `date` are retrieved from the data range on `sheet`.\r\n\r\n- If `var object = { range: range, date: date};` is used, date values which are the same with `date` are retrieved from `range` on the active sheet of the active Spreadsheet..\r\n\r\n- If `var object = {date: date};` is used, date values which are the same with `date` are retrieved from the data range on the active sheet of the active Spreadsheet.\r\n\r\n- When `from`, `to` and `date` are required to be the date object.\r\n\r\n- When all `from`, `to` and `date` are not included in the object, an error occurs.\r\n\r\n- When the results don't match with the search parameter, `null` is returned.\r\n\r\n### Sample script 2\r\n\r\n```javascript\r\nvar spreadsheetId = \"###\";\r\nvar sheetName = \"Sheet1\";\r\n\r\nvar sheet = SpreadsheetApp.openById(spreadsheetId).getSheetByName(sheetName);\r\n\r\nvar obj = { sheet: sheet, date: new Date(\"2020/01/01\") };\r\nvar res = DateFinder.search(obj);\r\nres.setBackground(\"red\");\r\n```\r\n\r\n- In this sample script, the ranges and values of `date` (In this case, it's `2020/01/01 00:00:00`.) are retrieved from the data range on \"Sheet1\" in the Spreadsheet of \"###\". And the background color of searched range is changed to the red color.\r\n\r\n---\r\n\r\n## Reference\r\n\r\n- [Class RangeList](https://developers.google.com/apps-script/reference/spreadsheet/range-list)\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 (January 30, 2020)\r\n\r\n  1. Initial release.\r\n\r\n[TOP](#top)\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftanaikech%2Fdatefinder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftanaikech%2Fdatefinder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftanaikech%2Fdatefinder/lists"}