{"id":17261393,"url":"https://github.com/dmitrysharabin/mavo-gsheets","last_synced_at":"2025-04-14T07:12:16.860Z","repository":{"id":44146661,"uuid":"316819962","full_name":"DmitrySharabin/mavo-gsheets","owner":"DmitrySharabin","description":"Google Sheets backend plugin for Mavo.","archived":false,"fork":false,"pushed_at":"2023-12-11T13:45:10.000Z","size":108,"stargazers_count":6,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-27T20:51:16.617Z","etag":null,"topics":["backend","google-sheets-api-v4","mavo","plugin"],"latest_commit_sha":null,"homepage":"https://dmitrysharabin.github.io/mavo-gsheets/demo.html","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/DmitrySharabin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2020-11-28T20:53:04.000Z","updated_at":"2024-02-10T06:25:15.000Z","dependencies_parsed_at":"2023-12-01T00:22:23.389Z","dependency_job_id":"3106b0b3-fd9e-47b7-a20d-3a22e9094cc5","html_url":"https://github.com/DmitrySharabin/mavo-gsheets","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DmitrySharabin%2Fmavo-gsheets","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DmitrySharabin%2Fmavo-gsheets/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DmitrySharabin%2Fmavo-gsheets/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DmitrySharabin%2Fmavo-gsheets/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DmitrySharabin","download_url":"https://codeload.github.com/DmitrySharabin/mavo-gsheets/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248837285,"owners_count":21169374,"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":["backend","google-sheets-api-v4","mavo","plugin"],"created_at":"2024-10-15T07:50:58.106Z","updated_at":"2025-04-14T07:12:16.830Z","avatar_url":"https://github.com/DmitrySharabin.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Google Sheets Backend\n\n**Note:** Below, everything that applied to `mv-storage` could be applied to `mv-source` and `mv-init` as well.\n\n## Restrictions\n\n1. Data must have headings:\n   - in the *first row of the specified range*, if data is organized *in rows* (i.e., one row = one set of data)\n   - in the *first column of the specified range*, if data is organized *in columns* (i.e., one column = one set of data).\n2. The plugin can work with only one collection. If the app has more than one collection, only the *first* one will be used.\n3. Property names inside the collection must correspond to headings in a spreadsheet. For example, if there is a row/column with the “year“ heading in the spreadsheet, to use data from this row/column inside the app, there should be the `year` property in the corresponding collection.\n\n**Note:** The headings must contain **only** letters, numbers, and underscores (_). Otherwise, the `transformHeadings` option must be provided in the `mv-storage-options` attribute. In that case, the plugin will do its best to transform headings into [allowed names of properties](https://mavo.io/docs/properties#property-name-rules) automatically. For example, the “Month name” heading will be transformed into “month_name”.\n\n### Example: Data in rows\n\n| foo | bar | baz |\n|-----|-----|-----|\n|  1  |  2  |  3  |\n|  4  |  5  |  6  |\n|  7  |  8  |  9  |\n\n### Example: Data in columns\n\n\u003ctable\u003e\n \u003ctr\u003e\u003cth\u003efoo\u003c/th\u003e\u003ctd\u003e1\u003c/td\u003e\u003ctd\u003e4\u003c/td\u003e\u003ctd\u003e7\u003c/td\u003e\u003c/tr\u003e\n \u003ctr\u003e\u003cth\u003ebar\u003c/th\u003e\u003ctd\u003e2\u003c/td\u003e\u003ctd\u003e5\u003c/td\u003e\u003ctd\u003e8\u003c/td\u003e\u003c/tr\u003e\n \u003ctr\u003e\u003cth\u003ebaz\u003c/th\u003e\u003ctd\u003e3\u003c/td\u003e\u003ctd\u003e6\u003c/td\u003e\u003ctd\u003e9\u003c/td\u003e\u003c/tr\u003e\n\u003c/table\u003e\n\n## Setting Up\n\nShare a spreadsheet and use the provided **URL** as a value for `mv-storage` and specify additional parameters via the `mv-storage-*` family of attributes if needed.\n\nTo write data back to the spreadsheet (if allowed by specified permissions), users must log in.\n\nThe plugin supports *private spreadsheets* as well. However, to read data from and write them back to a private spreadsheet, you *must* log in. The plugin won't let you work with *other's private spreadsheets*, only yours.\n\n**Note:** You can find additional information about sharing a spreadsheet with the corresponding permissions in the [Google Sheets help](https://support.google.com/docs/answer/2494822?hl=en).\n\n## Supported values of the `mv-storage-*` family of attributes\n\n| Value         | Description                                                                                             |\n|---------------|---------------------------------------------------------------------------------------------------------|\n| `sheet`       | (*Optional*) A sheet title to read/write data from/to. If not provided, the first visible sheet will be used. \u003cbr /\u003e **Note:** If there is no sheet with the specified name in the spreadsheet, it will be created while saving data.  |\n| `range`       | (*Optional*) A range with data in *A1 notation*. If not specified, the plugin will try to find the first not empty range of cells with data. |\n| `spreadsheet` | (*Optional*) A spreadsheet id. The value between the `/d/` and the `/edit` in the URL of a spreadsheet. By specifying this value, you can redefine the spreadsheet id the plugin got from the provided spreadsheet URL. In other words, you'll be able to work with another spreadsheet. |\n| `options` | (*Optional*) The plugin supports a number of options for customizing the way it reads/writes data from/to a spreadsheet. The supported options are `formattedValues`, `dataInColumns`, and `transformHeadings`. For details, see the **Supported options** section below. |\n\n**Note:** We recommend providing either *sheet title* or *range* to avoid extra network requests.\n\n## A1 notation for specifying cell ranges\n\nThis is a string like `A1:B2` that refers to a group of cells in the sheet (the first visible sheet) and is typically used in formulas. For example, valid ranges are:\n\n- `A1:B2` refers to the first two cells in the top two rows of the sheet.\n- `A:C` refers to all the cells in the first three columns of the sheet.\n- `1:2` refers to all the cells in the first two rows of the sheet.\n- `A5:A` refers to all the cells of the first column of the sheet, from row 5 onward.\n- `C2:2` refers to all the cells of the second row of the sheet, from column C onward.\n\n**Note:** Named ranges are also supported.\n\n## Customization\n\nThe plugin supports a number of options for customizing the way it reads/writes data from/to a spreadsheet. You can specify these options by using the `mv-storage-options` attribute. To separate the options, you can use either commas or semicolons. For example, `mv-storage-options=\"dataInColumns, transformHeadings\"`.\n\n### Supported options\n\n| Option             | Description                                                                                                                        |\n|--------------------|------------------------------------------------------------------------------------------------------------------------------------|\n| `formattedValues`  | Determines whether values should be displayed according to the cell's formatting on the sheet (if this option is provided) or not. |\n| `dataInColumns`    | If provided, that indicates that data is organized *in columns* (i.e., one column = one set of data) and the headings are **in the first column** of the specified range, not the first row.                                              |\n| `transformHeadings` | If provided, the plugin will convert headings so that they can be used as property names: will convert accented letters to [ASCII](https://en.wikipedia.org/wiki/ASCII), all the letters to lowercase, etc. **Hyphens and spaces will be converted into underscores.** For example, the “Month name” heading will be transformed into “month_name”.  |\n\n### Localization strings\n\n| id                                      | Value                                                                                                                                             |\n|-----------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------|\n| `mv-gsheets-range-not-provided`         | If there is more than one table with data on a sheet, you should provide a range with the needed data. For more information, see the plugin docs. |\n| `mv-gsheets-bad-headings`         | It looks like not all your headings can be used as property names. Please, make sure that all cells in the heading row/column are not empty and follow the property name rules (https://mavo.io/docs/properties#property-name-rules). In some cases, specifying the more narrow cell range and/or the transformHeadings option might help. The headings are: {headings}. |\n| `mv-gsheets-login-to-proceed` | You must be logged in to save data to the spreadsheet. Re-login and try again. |\n| `mv-gsheets-write-permission-denied`    | You don't have permission to save data to the spreadsheet.                                                                                        |\n| `mv-gsheets-read-permission-denied`     | You don't have permission to read data from the spreadsheet.                                                                                      |\n| `mv-gsheets-unsupported-data-structure` | It looks like your app's data has a structure that is not supported by the Google Sheets plugin.                                                        |\n| `mv-gsheets-spreadsheet-not-found`      | We couldn't find the spreadsheet you specified.                                                                                                   |\n| `mv-gsheets-no-sheet-or-invalid-range`  | There is no sheet with the specified name in the spreadsheet, and/or the format you used to specify the data range is invalid.                    |\n| `mv-gsheets-invalid-range`              | The format you used to specify the data range for storing your data is invalid.                                                                   |\n| `mv-gsheets-no-sheet-to-store-data`     | We couldn't find the ”{name}“ sheet in the spreadsheet and created it.                                                                              |\n| `mv-gsheets-small-range`                | The range you specified isn't large enough to store all your data.                                                                                |\n\n## Demo 1\n\n```markup\n\u003cdiv mv-app=\"todoApp\" mv-plugins=\"gsheets\"\n  mv-storage=\"https://docs.google.com/spreadsheets/d/14bzCuziKutrA3iESarKoj2o56dhraR8pzuFAuwTIo-g/edit?usp=sharing\"\n  mv-storage-sheet=\"Todos\"\u003e\n\n \u003ch2\u003eTodo List\u003c/h2\u003e\n \u003cp mv-multiple=\"todo\"\u003e\n  \u003clabel\u003e\n   \u003cinput type=\"checkbox\" property=\"done\" /\u003e\n   \u003cspan property=\"taskTitle\"\u003e\u003c/span\u003e\n  \u003c/label\u003e\n \u003c/p\u003e\n\u003c/div\u003e\n```\n\n## Demo 2\n\n```markup\n\u003cdiv mv-app mv-plugins=\"gsheets\"\n  mv-source=\"https://docs.google.com/spreadsheets/\"\n  mv-source-spreadsheet=\"14bzCuziKutrA3iESarKoj2o56dhraR8pzuFAuwTIo-g\"\n  mv-source-range=\"1:2\"\n  mv-source-options=\"dataInColumns, transformHeadings\"\u003e\n\n \u003ch2\u003eData in Columns\u003c/h2\u003e\n \u003cp property mv-multiple\u003e\n  \u003cspan property=\"id\"\u003e\u003c/span\u003e\n  \u003cspan property=\"value\"\u003e\u003c/span\u003e\n \u003c/p\u003e\n\u003c/div\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdmitrysharabin%2Fmavo-gsheets","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdmitrysharabin%2Fmavo-gsheets","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdmitrysharabin%2Fmavo-gsheets/lists"}