{"id":22688445,"url":"https://github.com/javanile/google-spreadsheet-buffer","last_synced_at":"2026-05-04T03:32:02.162Z","repository":{"id":237709639,"uuid":"795100985","full_name":"javanile/google-spreadsheet-buffer","owner":"javanile","description":"Google Spreadsheet Buffer","archived":false,"fork":false,"pushed_at":"2024-05-03T14:14:23.000Z","size":35,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-04T16:50:34.667Z","etag":null,"topics":["google-spreadsheet","mariadb"],"latest_commit_sha":null,"homepage":"","language":"Shell","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/javanile.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":"2024-05-02T15:29:16.000Z","updated_at":"2024-05-03T16:08:54.000Z","dependencies_parsed_at":null,"dependency_job_id":"4b17986d-3d36-4702-aa41-c4dae77f0bc0","html_url":"https://github.com/javanile/google-spreadsheet-buffer","commit_stats":null,"previous_names":["javanile/google-spreadsheet-buffer"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/javanile%2Fgoogle-spreadsheet-buffer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/javanile%2Fgoogle-spreadsheet-buffer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/javanile%2Fgoogle-spreadsheet-buffer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/javanile%2Fgoogle-spreadsheet-buffer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/javanile","download_url":"https://codeload.github.com/javanile/google-spreadsheet-buffer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246207509,"owners_count":20740723,"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":["google-spreadsheet","mariadb"],"created_at":"2024-12-10T00:14:29.114Z","updated_at":"2026-05-04T03:31:57.141Z","avatar_url":"https://github.com/javanile.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Google Spreadsheet Buffer\n\nBuffer is a lightweight Docker project designed to serve as a wrapper for MariaDB databases. \nIt exposes REST APIs allowing users to send SQL queries to a MariaDB database. \nThis project also includes a custom function `BUFFER_QUERY` which enables the execution of SQL queries directly from Google Spreadsheet.\n\n## Table of Contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Endpoints](#endpoints)\n- [Custom Function](#custom-function)\n- [Contributing](#contributing)\n- [License](#license)\n\n## Tech Stack\n\n- Docker\n- Ngrok\n- Google Spreadsheet\n- MariaDB\n\n## Installation\n\nTo run Buffer locally, make sure you have Docker installed on your system. Then follow these steps:\n\n1. Clone this repository:\n\n    ```\n    git clone https://github.com/javanile/google-spreadsheet-buffer.git\n    ```\n\n2. Navigate to the project directory:\n\n    ```\n    cd google-spreadsheet-buffer\n    ```\n\n3. Run the Docker container:\n\n    ```\n    make start\n    ```\n\nBuffer is now running locally on port 6612.\n\nPlease note: For testing in a public environment, remember to modify the `BUFFER_PASSWORD` variable in the `docker-compose.yml` file to ensure security.\n\n## Usage\n\nTo use Buffer, you can send HTTP requests to the exposed REST endpoints. Additionally, you can leverage the custom function BUFFER_QUERY directly from Google Spreadsheet to execute SQL queries on the database.\n\nPlease note that when using Buffer locally, you'll need to install Ngrok to expose the local container to your Google Sheets:\n\nInstall Ngrok on your system following the instructions provided on the Ngrok website.\nRun Ngrok and expose the local port where Buffer is running by executing the following command:\n    \n```\nngrok http 6612\n```\n\nCopy the Ngrok URL provided (e.g., https://randomstring.ngrok.io).\n\nConfigure Google Sheets to use the Ngrok URL as the endpoint for BUFFER_QUERY function.\n\nWith Ngrok set up, you can now interact with your local Buffer instance directly from your Google Spreadsheet!\"\n\n## Examples\n\nRun as standalone container\n\n```shell\ndocker run -d -e BUFFER_PASSWORD=Secret1234! -p 6612:6612 javanile/buffer\n```\n\nCreate table and insert data\n\n```shell\nexport BUFFER_TOKEN=$(echo -n '{\"password\":\"'${BUFFER_PASSWORD}'\"}' | base64)\n\ncurl -H \"Authorization: Bearer ${BUFFER_TOKEN}\" localhost:6612 -d '\n  CREATE TABLE my_table (\n    my_field_1 VARCHAR(100),\n    my_field_2 VARCHAR(100)\n  );  \n  INSERT INTO my_table (my_field_1, my_field_2) VALUES (\"Hello\", \"World\");\n'\n```\n\nExecute query inside Google Spreadsheet\n\n```shell    \n=BUFFER_QUERY(\"Secret1234!@b48d-1X6-1X7-1X5-Y4.ngrok-free.app\"; \"SELECT * FROM my_table\")\n```\n\n## Connection String\n\nThe connection string for Buffer is as follows:\n\n```\n[protocol]://[username]:[password]@[host]:[port]/[database]\n```\n\nFor example:\n\n- `\"MyBufferPassword@mybufferhost.net\"` (default protocol and port)\n- `\"http://MyBufferPassword@mybufferhost:6612\"` (custom protocol and port)\n- `\"http://MyBufferUsername:MyBufferPassword@mybufferhost:6612/BufferDatabase\"` (full string)\n\n## Custom Function\n\nBuffer includes a custom function `BUFFER_QUERY` which allows users to execute SQL queries directly from Google Spreadsheet. \nSimply include the function in your spreadsheet and provide the SQL query as an argument [(Read mode)](https://developers.google.com/apps-script/guides/sheets/functions).\n\n```javascript\nfunction BUFFER_QUERY(url, query, options) {\n  const accessToken = {};\n  const regex = /^(?:([A-Za-z]+):\\/\\/)?(?:([A-Za-z0-9_]+):)?([A-Za-z0-9\\-._~%!$\u0026'()*+,;=]+)@([A-Za-z0-9.-]+)(?::([0-9]+))?(?:\\/([A-Za-z0-9_]+))?$/;\n  const match = url.match(regex);\n  \n  if (!match) {\n    throw \"Malformed url\";\n  }\n  \n  match[1] = String(match[1] || 'https').toLowerCase();\n  match[5] = match[5] ? ':' + match[5] : (match[1] != 'https' ? ':6612' : '');\n\n  accessToken.database = match[6] || (match[2] || \"buffer\");\n  accessToken.username = match[2] || \"buffer\";\n  accessToken.password = match[3];\n  \n  url = match[1] + '://' + match[4] + match[5] + '?options=' + options;    \n  \n  var response = UrlFetchApp.fetch(url, {\n    headers: {\n      \"Authorization\": \"Bearer \" + Utilities.base64Encode(JSON.stringify(accessToken)),\n      \"ngrok-skip-browser-warning\": \"69420\"\n    },\n    payload: query\n  });\n\n  return JSON.parse(response.getContentText())\n}\n```\n\n## Contributing\n\nContributions are welcome! Feel free to submit pull requests or open issues for any enhancements or bug fixes.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjavanile%2Fgoogle-spreadsheet-buffer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjavanile%2Fgoogle-spreadsheet-buffer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjavanile%2Fgoogle-spreadsheet-buffer/lists"}