{"id":23139264,"url":"https://github.com/mathieu2301/sheetstomongo","last_synced_at":"2025-04-04T10:12:14.096Z","repository":{"id":267453658,"uuid":"901258667","full_name":"Mathieu2301/SheetsToMongo","owner":"Mathieu2301","description":"Send data from a Google Sheets file to MongoDB","archived":false,"fork":false,"pushed_at":"2025-01-12T12:29:58.000Z","size":32,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-28T08:13:34.517Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Mathieu2301.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":"2024-12-10T10:29:41.000Z","updated_at":"2025-01-12T12:30:01.000Z","dependencies_parsed_at":"2025-01-12T13:30:20.457Z","dependency_job_id":"ad622c34-3906-47f0-8bd7-cac11c776572","html_url":"https://github.com/Mathieu2301/SheetsToMongo","commit_stats":null,"previous_names":["mathieu2301/sheetstomongo"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mathieu2301%2FSheetsToMongo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mathieu2301%2FSheetsToMongo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mathieu2301%2FSheetsToMongo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mathieu2301%2FSheetsToMongo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Mathieu2301","download_url":"https://codeload.github.com/Mathieu2301/SheetsToMongo/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247157287,"owners_count":20893221,"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":[],"created_at":"2024-12-17T13:13:39.558Z","updated_at":"2025-04-04T10:12:14.078Z","avatar_url":"https://github.com/Mathieu2301.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SheetsToMongo\n\nThis is a Google Apps Script project that allows you to import data from Google Sheets into MongoDB.\n\n## Setup\n\n1. In your Google Sheets document, click on `Extensions` in the menu bar and then click on `Apps Script`.\n\n2. Click on the `+` button next to `Library` in the sidebar,\n    paste the project ID `1LeC5V6SEzbqWreUBIarpEYPHBVljtNI6WUaPxKAqOF618DuSM4Ty4c-3`,\n    click on `Search` and then click on `Add`.\n\n3. Create a new `SheetsToMongo` file and paste the code below into the editor:\n\n    ```typescript\n    // Function called by the button\n    function submitData() {\n      const field = SheetsToMongo.field;\n\n      SheetsToMongo.createUpdateRequest({\n        lang: 'en',\n        apiUrl: 'https://\u003curl-of-the-stm-bridge\u003e',\n        collectName: 'stm_users_test',\n        tableMap: (row, i) =\u003e row.some(Boolean)\n          ? {\n            _id: i + 3,\n            email:     field('string', row[0]),\n            username:  field('string', row[1]),\n            firstName: field('string', row[2]),\n            lastName:  field('string', row[3]),\n            birthData: field('date', row[4]),\n            age:       field('number', row[5]),\n            role:      field('string', row[6]),\n            active:    field('boolean', row[7]),\n            comment:   field('string', row[8], null),\n            imageUrl:  field('string', row[9]),\n          }\n          : null,\n        displayTemplate: '{{username}} ({{role}})',\n      });\n    }\n\n    // Create a menu in the menu bar\n    function addMenu() {\n      const ui = SpreadsheetApp.getUi();\n      ui.createMenu('SheetsToMongo')\n        .addItem('Submit', 'submitData')\n        .addToUi();\n    }\n\n    // Necessary for SheetsToMongo to work\n    function sendCommand() {\n      SheetsToMongo.sendCommand(arguments);\n    }\n    ```\n\n4. (optional) Go to `Triggers` in the sidebar and click on `Add Trigger`. The select the `addMenu` function and click on `Save`.\n\n5. (optional) In your Google Sheets document, select the `A1` cell, click on `Insert` in the menu bar and then click on `Drawing`.\nAdd a rectangle shape with `Apply` title, then click on `Save and Close`.\nAdjust the size of the rectangle to fit the `A1` cell.\nRight-click on the rectangle and click on `Assign script`.\nType `submitData` and click on `OK`.\n\n6. Copy the table from this example \u003chttps://docs.google.com/spreadsheets/d/1u4HZnrn-koOQDTpGA9DYg4P1ID4FVw0SXO--b22xhQ8/edit?usp=sharing\u003e to your Google Sheets document.\n\n7. You can now use `SheetsToMongo`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmathieu2301%2Fsheetstomongo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmathieu2301%2Fsheetstomongo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmathieu2301%2Fsheetstomongo/lists"}