{"id":22940810,"url":"https://github.com/scottgriv/sql-mssql_excel_export","last_synced_at":"2025-04-01T20:36:47.157Z","repository":{"id":163780238,"uuid":"630261660","full_name":"scottgriv/sql-mssql_excel_export","owner":"scottgriv","description":"Export data from Microsoft SQL Server to Excel.","archived":false,"fork":false,"pushed_at":"2025-01-09T04:27:34.000Z","size":437,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-28T18:32:32.507Z","etag":null,"topics":["excel","excel-export","excel-exporter","microsoft-sql-server","microsoft-sql-server-management-studio","microsoft-sqlserver-database","mssql","mssql-database","mssql-server","sql","sql-database","sql-server"],"latest_commit_sha":null,"homepage":"","language":"TSQL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/scottgriv.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}},"created_at":"2023-04-20T02:25:00.000Z","updated_at":"2025-01-09T04:27:38.000Z","dependencies_parsed_at":"2023-12-12T01:08:25.670Z","dependency_job_id":null,"html_url":"https://github.com/scottgriv/sql-mssql_excel_export","commit_stats":null,"previous_names":["scottgriv/sql-mssql_excel_export"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scottgriv%2Fsql-mssql_excel_export","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scottgriv%2Fsql-mssql_excel_export/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scottgriv%2Fsql-mssql_excel_export/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scottgriv%2Fsql-mssql_excel_export/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/scottgriv","download_url":"https://codeload.github.com/scottgriv/sql-mssql_excel_export/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246709931,"owners_count":20821297,"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":["excel","excel-export","excel-exporter","microsoft-sql-server","microsoft-sql-server-management-studio","microsoft-sqlserver-database","mssql","mssql-database","mssql-server","sql","sql-database","sql-server"],"created_at":"2024-12-14T13:32:23.633Z","updated_at":"2025-04-01T20:36:47.126Z","avatar_url":"https://github.com/scottgriv.png","language":"TSQL","funding_links":["https://www.buymeacoffee.com/scottgriv"],"categories":[],"sub_categories":[],"readme":"\u003c!-- Begin README --\u003e\r\n\r\n\u003cdiv align=\"center\"\u003e\r\n    \u003ca href=\"https://www.microsoft.com/en-us/sql-server/sql-server-downloads\" target=\"_blank\"\u003e\r\n        \u003cimg src=\"./docs/images/icon.png\" width=\"150\" height=\"150\"/\u003e\r\n    \u003c/a\u003e\r\n\u003c/div\u003e\r\n\u003cbr\u003e\r\n\u003cp align=\"center\"\u003e\r\n    \u003ca href=\"https://www.microsoft.com/en-us/sql-server/sql-server-2022\"\u003e\u003cimg src=\"https://img.shields.io/badge/Microsoft_SQL_Server-2022-CC2927?style=for-the-badge\u0026logo=microsoftsqlserver\" alt=\"SQL Server Badge\" /\u003e\u003c/a\u003e\r\n    \u003ca href=\"https://www.microsoft.com/en-us/microsoft-365/excel\"\u003e\u003cimg src=\"https://img.shields.io/badge/Excel-2022-217346?style=for-the-badge\u0026logo=microsoftexcel\" alt=\"Excel Badge\" /\u003e\u003c/a\u003e\r\n    \u003cbr\u003e\r\n    \u003ca href=\"https://github.com/scottgriv\"\u003e\u003cimg src=\"https://img.shields.io/badge/github-follow_me-181717?style=for-the-badge\u0026logo=github\u0026color=181717\" alt=\"GitHub Badge\" /\u003e\u003c/a\u003e\r\n    \u003ca href=\"mailto:scott.grivner@gmail.com\"\u003e\u003cimg src=\"https://img.shields.io/badge/gmail-contact_me-EA4335?style=for-the-badge\u0026logo=gmail\" alt=\"Email Badge\" /\u003e\u003c/a\u003e\r\n    \u003ca href=\"https://www.buymeacoffee.com/scottgriv\"\u003e\u003cimg src=\"https://img.shields.io/badge/buy_me_a_coffee-support_me-FFDD00?style=for-the-badge\u0026logo=buymeacoffee\u0026color=FFDD00\" alt=\"BuyMeACoffee Badge\" /\u003e\u003c/a\u003e\r\n    \u003cbr\u003e\r\n    \u003ca href=\"https://prgportfolio.com\" target=\"_blank\"\u003e\u003cimg src=\"https://img.shields.io/badge/PRG-Bronze Project-CD7F32?style=for-the-badge\u0026logo=data:image/svg%2bxml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBzdGFuZGFsb25lPSJubyI/Pgo8IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDIwMDEwOTA0Ly9FTiIKICJodHRwOi8vd3d3LnczLm9yZy9UUi8yMDAxL1JFQy1TVkctMjAwMTA5MDQvRFREL3N2ZzEwLmR0ZCI+CjxzdmcgdmVyc2lvbj0iMS4wIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciCiB3aWR0aD0iMjYuMDAwMDAwcHQiIGhlaWdodD0iMzQuMDAwMDAwcHQiIHZpZXdCb3g9IjAgMCAyNi4wMDAwMDAgMzQuMDAwMDAwIgogcHJlc2VydmVBc3BlY3RSYXRpbz0ieE1pZFlNaWQgbWVldCI+Cgo8ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgwLjAwMDAwMCwzNC4wMDAwMDApIHNjYWxlKDAuMTAwMDAwLC0wLjEwMDAwMCkiCmZpbGw9IiNDRDdGMzIiIHN0cm9rZT0ibm9uZSI+CjxwYXRoIGQ9Ik0xMiAzMjggYy04IC04IC0xMiAtNTEgLTEyIC0xMzUgMCAtMTA5IDIgLTEyNSAxOSAtMTQwIDQyIC0zOCA0OAotNDIgNTkgLTMxIDcgNyAxNyA2IDMxIC0xIDEzIC03IDIxIC04IDIxIC0yIDAgNiAyOCAxMSA2MyAxMyBsNjIgMyAwIDE1MCAwCjE1MCAtMTE1IDMgYy04MSAyIC0xMTkgLTEgLTEyOCAtMTB6IG0xMDIgLTc0IGMtNiAtMzMgLTUgLTM2IDE3IC0zMiAxOCAyIDIzCjggMjEgMjUgLTMgMjQgMTUgNDAgMzAgMjUgMTQgLTE0IC0xNyAtNTkgLTQ4IC02NiAtMjAgLTUgLTIzIC0xMSAtMTggLTMyIDYKLTIxIDMgLTI1IC0xMSAtMjIgLTE2IDIgLTE4IDEzIC0xOCA2NiAxIDc3IDAgNzIgMTggNzIgMTMgMCAxNSAtNyA5IC0zNnoKbTExNiAtMTY5IGMwIC0yMyAtMyAtMjUgLTQ5IC0yNSAtNDAgMCAtNTAgMyAtNTQgMjAgLTMgMTQgLTE0IDIwIC0zMiAyMCAtMTgKMCAtMjkgLTYgLTMyIC0yMCAtNyAtMjUgLTIzIC0yNiAtMjMgLTIgMCAyOSA4IDMyIDEwMiAzMiA4NyAwIDg4IDAgODggLTI1eiIvPgo8L2c+Cjwvc3ZnPgo=\" alt=\"Bronze\" /\u003e\u003c/a\u003e\r\n\u003c/p\u003e\r\n\r\n---------------\r\n\r\n\u003ch1 align=\"center\"\u003eExport Microsoft SQL Server to Excel\u003c/h1\u003e\r\n\r\nExport data from a Microsoft SQL Server database to an Excel spreadsheet using this query.\r\n\r\n---------------\r\n\r\n## Table of Contents\r\n\r\n- [Getting Started](#getting-started)\r\n- [Resources](#resources)\r\n- [License](#license)\r\n- [Credits](#credits)\r\n\r\n## Getting Started\r\n\r\nRun the query inside of the `excel_export.sql`, changing the following configuration options to your needs:\r\n- xp_cmdshell is a system stored procedure in SQL Server. It allows executing Windows shell commands from the SQL Server environment. While commands are passed as an input string, the shell's output is returned as rows of text.\r\n- Change -S to your DB server and -d to your Database, then change the query to what you want.\r\n- If you want to hide the column headers, add the flag: -h-1 after the .csv\" syntax. The only issue is that the dashes are tied to the column header.\r\n- To remove the dashes but keep the header, do a UNION in your query with your column headers.\r\n- 700 is the max width I set so you can adjust it if your columns are smaller/larger. This is for ALL columns.\r\n- I’ve also remove the “Rows Affected” output from the bottom of the file by the “no_output” switch at the end of the command\r\n- Adjust the -o flag to your desired output path and file name.\r\n\r\n## Resources\r\n\r\n- [Microsoft SQL Server - 2022 Home](https://www.microsoft.com/en-us/sql-server/sql-server-2022)\r\n- [Microsoft SQL Server - 2022 Documentation](https://learn.microsoft.com/en-us/sql/sql-server/?view=sql-server-ver16)\r\n- [Microsoft SQL Server - Downloads](https://www.microsoft.com/en-us/sql-server/sql-server-downloads)\r\n- [Microsoft Excel](https://www.microsoft.com/en-us/microsoft-365/excel)\r\n\r\n## License\r\n\r\nThis project is released under the terms of **The Unlicense**, which allows you to use, modify, and distribute the code as you see fit. \r\n- [The Unlicense](https://choosealicense.com/licenses/unlicense/) removes traditional copyright restrictions, giving you the freedom to use the code in any way you choose.\r\n- For more details, see the [LICENSE](LICENSE) file in this repository.\r\n\r\n## Credits\r\n\r\n**Author:** [Scott Grivner](https://github.com/scottgriv) \u003cbr\u003e\r\n**Email:** [scott.grivner@gmail.com](mailto:scott.grivner@gmail.com) \u003cbr\u003e\r\n**Website:** [scottgrivner.dev](https://www.scottgrivner.dev) \u003cbr\u003e\r\n**Reference:** [Main Branch](https://github.com/scottgriv/sql-mssql_excel_export) \u003cbr\u003e\r\n\r\n---------------\r\n\r\n\u003cdiv align=\"center\"\u003e\r\n    \u003ca href=\"https://scottgrivner.dev\" target=\"_blank\"\u003e\r\n        \u003cimg src=\"./docs/images/footer.png\" width=\"100\" height=\"100\"/\u003e\r\n    \u003c/a\u003e\r\n\u003c/div\u003e\r\n\r\n\u003c!-- End README --\u003e","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscottgriv%2Fsql-mssql_excel_export","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscottgriv%2Fsql-mssql_excel_export","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscottgriv%2Fsql-mssql_excel_export/lists"}