{"id":17607259,"url":"https://github.com/huksley/generate-content-spreadsheet","last_synced_at":"2026-01-07T19:44:42.911Z","repository":{"id":148570574,"uuid":"620519461","full_name":"huksley/generate-content-spreadsheet","owner":"huksley","description":"Use Google Spreadsheet as simple, painless, robust CMS for text and structured content","archived":false,"fork":false,"pushed_at":"2024-09-15T20:29:57.000Z","size":48,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-25T07:45:28.751Z","etag":null,"topics":["cms","nextjs","spreadsheet"],"latest_commit_sha":null,"homepage":"","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/huksley.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2023-03-28T21:01:04.000Z","updated_at":"2024-09-15T20:30:00.000Z","dependencies_parsed_at":"2024-09-15T21:38:04.243Z","dependency_job_id":"39245392-1fe0-4e25-9a24-3ca2e097db48","html_url":"https://github.com/huksley/generate-content-spreadsheet","commit_stats":{"total_commits":16,"total_committers":3,"mean_commits":5.333333333333333,"dds":0.3125,"last_synced_commit":"d31c2193cb3646e4e833548fbd9fbbe9f8229176"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huksley%2Fgenerate-content-spreadsheet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huksley%2Fgenerate-content-spreadsheet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huksley%2Fgenerate-content-spreadsheet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huksley%2Fgenerate-content-spreadsheet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/huksley","download_url":"https://codeload.github.com/huksley/generate-content-spreadsheet/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242353266,"owners_count":20114040,"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":["cms","nextjs","spreadsheet"],"created_at":"2024-10-22T16:09:20.816Z","updated_at":"2026-01-07T19:44:42.872Z","avatar_url":"https://github.com/huksley.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Generate content spreadsheet\n\nUse Google Spreadsheet as simple, painless, robust CMS for text and structured content!\n\nFrom your (publicly shared) Google Spreadsheet, creates content as JavaScript (TypeScript) object and allows it to be automatically updated whenever you recompile your code and update the spreadsheet.\n\nWorks beautifully with NextJS or any Webpack environment where you can add Webpack plugin!\n\nCreates typed content structure so your DevEx is great, as you can just discover the content object as you type.\n\nBased on [public-google-sheets-parser](https://www.npmjs.com/package/public-google-sheets-parser) JavaScript package, which can parse publically available spreadsheets without the need of authorization.\n\n## Example usage (NextJS)\n\nAdd to your ./next.config.js:\n\n```js\nconst { GenerateContentSpreadsheetPlugin } = require(\"generate-content-spreadsheet\");\n\nconst nextConfig = {\n  reactStrictMode: false,\n  webpack: (config, { isServer }) =\u003e {\n    config.plugins?.push(\n      new GenerateContentSpreadsheetPlugin(\n        // Script it will write (can be either .js or .ts)\n        __dirname + \"/components/Content.ts\",\n        // Variable in source file\n        \"Strings\",\n        // Spreadsheet id, see https://www.npmjs.com/package/public-google-sheets-parser\n        \"MY_SPREADSHEET_ID\",\n        // Spreadsheet tab name\n        \"Sheet1\",\n        // Spreadsheet tab gid\n        undefined\n      )\n    );\n    return config;\n  },\n};\n```\n\nThen, in your code, you can use it like this:\n\n```js\nimport { Strings } from \"../components/Content\";\n\nconst MyComponent = () =\u003e {\n  return \u003cdiv\u003e{Strings.title}\u003c/div\u003e;\n};\n```\n\n## How it works\n\nIt uses [public-google-sheets-parser](https://www.npmjs.com/package/public-google-sheets-parser) to parse your spreadsheet and then writes it to a TypeScript file.\n\nIt expects spreadsheet to have following REQUIRED columns:\n\n- **key** - JQ path to the object where to put the value, for example \"title\" or \"content.title\" or event \"content.description[]\"\n- **value** - String value to put in the object. WARNING: Only string values are supported!\n\n### Spreadsheet format:\n\nIt expects Google Spreadsheet with the following columns:\n\n| key                | value                       |\n| ------------------ | --------------------------- |\n| title              | My title                    |\n| root.title         | My index page title         |\n| root.description[] | My index page description 1 |\n| root.description[] | My index page description 2 |\n\n### Resulting output:\n\n```js\nexport const Strings = {\n  title: \"My title\",\n  root: {\n    title: \"My index page title\",\n    description: [\"My index page description 1\", \"My index page description 2\"],\n  },\n};\n```\n\n### Ready-to-use example\n\nYou can find ready-to-use NextJS example in the [example](./example) folder.\n\n## Installation\n\n```\nnpm i generate-content-spreadsheet\n```\n\n1. Create Google Spreadsheet\n2. Share it publicly (File =\u003e Share =\u003e Anyone with the link can view)\n3. Add Webpack plugin\n4. Seen plugin generates source file with content\n5. Import and use it in your front-end code\n6. Update spreadsheet and recompile your code\n7. ...\n8. Profit!\n\n## FAQ\n\n### Why?\n\nI needed a simple way to manage content for my NextJS website. I wanted to use Google Spreadsheet as a CMS, but I didn't want to use any of the existing solutions, because they were either too complicated or too expensive.\n\n### Why not use Headless CMS?\n\nIf you have lots of images, videos, or other files, then you will need to use fully featured CMS. But if you only need to manage simple text content, then you can use this package.\n\n### I am getting wrong columns\n\n- Make sure you have \"key\" and \"value\" columns in your spreadsheet. If you have different column names, then you can change them in the plugin options.\n- Make sure your content is forced to be TEXT. If you have numbers, Google Sheets returns wrong data.\n\n### License\n\nMIT License (c) 2023 Ruslan Gainutdinov\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhuksley%2Fgenerate-content-spreadsheet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhuksley%2Fgenerate-content-spreadsheet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhuksley%2Fgenerate-content-spreadsheet/lists"}