{"id":14974067,"url":"https://github.com/stefanov-sm/pg_spreadsheetml","last_synced_at":"2026-02-05T21:32:32.040Z","repository":{"id":146063670,"uuid":"238712015","full_name":"stefanov-sm/pg_spreadsheetml","owner":"stefanov-sm","description":"Export SQL query results in Excel","archived":false,"fork":false,"pushed_at":"2020-07-10T20:30:07.000Z","size":229,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-27T09:44:09.764Z","etag":null,"topics":["plpgsql","postgresql"],"latest_commit_sha":null,"homepage":"","language":"PLpgSQL","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/stefanov-sm.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-02-06T14:50:22.000Z","updated_at":"2020-10-04T20:16:28.000Z","dependencies_parsed_at":"2023-04-08T02:16:35.914Z","dependency_job_id":null,"html_url":"https://github.com/stefanov-sm/pg_spreadsheetml","commit_stats":{"total_commits":79,"total_committers":2,"mean_commits":39.5,"dds":"0.11392405063291144","last_synced_commit":"441b921b5ecae84e44620bd3e253c71d0f63ecc3"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/stefanov-sm/pg_spreadsheetml","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stefanov-sm%2Fpg_spreadsheetml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stefanov-sm%2Fpg_spreadsheetml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stefanov-sm%2Fpg_spreadsheetml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stefanov-sm%2Fpg_spreadsheetml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stefanov-sm","download_url":"https://codeload.github.com/stefanov-sm/pg_spreadsheetml/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stefanov-sm%2Fpg_spreadsheetml/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29135047,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-05T20:50:26.975Z","status":"ssl_error","status_checked_at":"2026-02-05T20:49:26.082Z","response_time":65,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["plpgsql","postgresql"],"created_at":"2024-09-24T13:49:54.466Z","updated_at":"2026-02-05T21:32:32.019Z","avatar_url":"https://github.com/stefanov-sm.png","language":"PLpgSQL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pg_spreadsheetml\nExports an SQL query result into Microsoft Excel format.  \npl/pgsql function returns [SpreadsheetML](https://en.wikipedia.org/wiki/Microsoft_Office_XML_formats) (XML format for storing Microsoft Excel spreadsheets) as **setof text**. \n\n\nThe prototype of the function is as follows:\n\n```PGSQL\nFUNCTION pg_spreadsheetml(arg_query text, arg_parameters json DEFAULT '{}'::json)\n RETURNS SETOF text\n LANGUAGE plpgsql SECURITY DEFINER\n```\n__arg_query__ is parameterised by plain text susbtitution (macro expansion).  \nMacro parameter placeholders are defined as valid uppercase identifiers with two underscores as prefix and suffix, i.e. `__NUMBER_OF_DAYS__`, `__COST__`, etc. See the [example](https://github.com/stefanov-sm/pg_spreadsheetml/tree/master/example) SQL-only and PHP CLI scripts.\n\nOptional __arg_parameters__ is JSON with parameters' names/values, e.g., \n`{\"number_of_days\":\"7 days\", \"cost\":15.00}`. \nParameter names are K\u0026R case-insensitive identifiers.  \n\n__Hyperlinks:__ Cell values that match this regex pattern `^#(.+)##(.+)$`, i.e. #_value_##_URL_ will be presented as hyperlinks.  \n\n__Note:__ pg_spreadsheetml is __injection prone__ and therefore it must be declared as a security definer owned by a limited user.\n\n\n__Note:__ The example runs against the popular [DVD rental](https://www.postgresqltutorial.com/postgresql-sample-database/) sample database.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstefanov-sm%2Fpg_spreadsheetml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstefanov-sm%2Fpg_spreadsheetml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstefanov-sm%2Fpg_spreadsheetml/lists"}