{"id":30523825,"url":"https://github.com/russelwebber/xlduckdb","last_synced_at":"2025-08-26T20:51:18.821Z","repository":{"id":267632327,"uuid":"899109635","full_name":"RusselWebber/xlDuckDb","owner":"RusselWebber","description":"Use DuckDB within Excel with the xlDuckDb addin","archived":false,"fork":false,"pushed_at":"2025-07-24T13:01:53.000Z","size":5633,"stargazers_count":88,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-07-24T17:13:24.826Z","etag":null,"topics":["duckdb","excel","exceldna"],"latest_commit_sha":null,"homepage":"","language":"C#","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/RusselWebber.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,"zenodo":null}},"created_at":"2024-12-05T16:30:57.000Z","updated_at":"2025-07-24T13:00:50.000Z","dependencies_parsed_at":"2025-07-10T11:54:17.566Z","dependency_job_id":"7255402e-8a7a-4247-8b11-accaaeb27db8","html_url":"https://github.com/RusselWebber/xlDuckDb","commit_stats":null,"previous_names":["russelwebber/xlduckdb"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/RusselWebber/xlDuckDb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RusselWebber%2FxlDuckDb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RusselWebber%2FxlDuckDb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RusselWebber%2FxlDuckDb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RusselWebber%2FxlDuckDb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RusselWebber","download_url":"https://codeload.github.com/RusselWebber/xlDuckDb/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RusselWebber%2FxlDuckDb/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266899055,"owners_count":24003003,"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","status":"online","status_checked_at":"2025-07-24T02:00:09.469Z","response_time":99,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["duckdb","excel","exceldna"],"created_at":"2025-08-26T20:51:17.727Z","updated_at":"2025-08-26T20:51:18.812Z","avatar_url":"https://github.com/RusselWebber.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"![GitHub Latest Tag](https://badgen.net/github/tag/RusselWebber/xlDuckDb) ![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/RusselWebber/xlDuckDb/ci.yml) ![GitHub Downloads](https://badgen.net/github/assets-dl/RusselWebber/xlDuckDb)\n\n# xlDuckDb\n\nUse DuckDB within Excel with the xlDuckDb addin.\n\nDuckDB is an amazing tool with deep integration with Python and R, but sometimes you just need data in Excel. xlDuckDb allows DuckDB SQL to be run within Excel. Query results are returned as regular Excel cells.\n\n![Run remote Parquet](https://github.com/RusselWebber/xlDuckDb/blob/main/images/duckdb_http_parquet.gif?raw=true)\n\n# Installation\n\nDownload the xlduckdb.zip file from the latest release on the right.\n\nUse the \"Extract All\" option on the right-click menu in Windows Explorer to extract contents of the zip file on your local PC.\n\nRight-click on the xlDuckDb64.xll file and unblock it:\n\n![Unblock xlDuckDb](https://github.com/RusselWebber/xlDuckDb/blob/main/images/xlduckdb_unblock.gif?raw=true)\n\nDouble click on the xlDuckDb64.xll file to open the addin in Excel. The function _DuckDbQuery_ will be registered automatically.\n\n## Requirements\n\nxlDuckDb only runs on 64-bit Excel 365 released after Sept 2018. The dynamic array resizing functionality is required.\n\nxlDuckDb v0.6.0 and above require the .Net 8.0 or later runtime. Usually a compatible version of .Net will already be installed, however the RunTime can also be downloaded from [.Net RunTime](https://dotnet.microsoft.com/en-us/download/dotnet/8.0)\n\n# Usage\n\nAny DuckDB SQL can be run and the results will be returned to Excel.\n\n### A note on copying queries into Excel\n\nWhen copying text such as SQL commands into Excel cells, add a **'** at the start so that Excel treats the input as a string.\n\n![Query Copy Tip](https://russelwebber.github.io/xlslim-docs/html/_images/duckdb_copy_text_to_excel.gif?raw=true)\n\n## Querying Excel Ranges\n\nExcel ranges can be queried as if the range was a regular DuckDb table. The keyword **xlRange** is used in queries, internally xlDuckDb substitutes the Excel range data.\n\n\u003e SELECT \\* FROM **xlRange**\n\nThe range is passed as the third argument to the DuckDbQuery() function.\n\nHere we copy in the 2024 F1 Drivers Points and query the range:\n\n![Querying Excel Range](images/xlduckdb_rangequery.gif)\n\nThe data is in the range A1:E25\n\n![Range Data](images/ExcelRangeSourceData.png)\n\nThe range is passed as the third argument:\n\n\u003e =DuckDbQuery(A27,,A1:E25)\n\nAnd the query is run against the Excel range:\n\n![Range Query](images/ExcelRangeQuery.png)\n\n### Named Ranges\n\nQueries can be run against named ranges.\n\n![Named Range Data](images/ExcelRangeDefineTable.png)\n\nHere we pass the named range DriverPoints:\n\n\u003e =DuckDbQuery(A27,,DriverPoints)\n\n![Query Named Range](images/ExcelRangeNamedRangeQuery.png)\n\n### Table Data\n\nQueries can be run against Excel table data.\n\n![Table Data](images/ExcelRangeDefineTable.png)\n\nHere we pass the table name PointsTable[All]:\n\n\u003e =DuckDbQuery(A27,,PointsTable[All])\n\n![Query Table](images/ExcelRangeTableQuery.png)\n\n## Querying JSON files\n\nReading data from JSON files can be difficult, particularly if the data is nested.\n\nThis JSON file contains details of Nobel prize laureates:\n\n![JSON data file](https://russelwebber.github.io/xlslim-docs/html/_images/duckdb_sample_json.png?raw=true)\n\nThe data is presented as a list of dictionaries with the prizes field being a further list of dictionaries.\n\nDuckDB allows the laureates names and birth countries to be extracted with a simple SQL SELECT. Notice how DuckDB allows the JSON file to be treated just like a regular database table:\n\n\u003e SELECT firstname, surname, bornCountry FROM 'laureate.json' LIMIT 5\n\nPassing the SQL into the DuckDbQuery() function gives the following result:\n\n![JSON query](https://russelwebber.github.io/xlslim-docs/html/_images/duckdb_json_top5.png?raw=true)\n\nWe can now easily find the countries with the most Nobel prize winners:\n\n\u003e SELECT bornCountry AS Country, COUNT(\\*) AS Number FROM 'laureate.json' GROUP BY bornCountry ORDER BY COUNT(\\*) DESC LIMIT 5\n\n![Second JSON Query](https://russelwebber.github.io/xlslim-docs/html/_images/duckdb_json_top_countries.png?raw=true)\n\nDuckDB supports the use of JSONPath to extract values from nested JSON fields. This allows us to extract the category and motivation of the first prize awarded to each person:\n\n\u003e SELECT firstname, surname, prizes-\u003e\u003e'\\$[0].category' AS Category, prizes-\u003e\u003e'\\$[0].motivation'AS Motivation FROM 'laureate.json' LIMIT 5\n\n![JSONPath Query](https://russelwebber.github.io/xlslim-docs/html/_images/duckdb_json_category_and_motivation.png?raw=true)\n\nFull details of DuckDB’s JSON capabilities are available in their documentation.\n\n## Querying CSV files\n\nData is often stored in CSV files. Surprisingly, CSV is not a standardised data format and many variations exist. DuckDB is able to handle most CSV files automatically, detecting the column delimiters, data types, and so on.\n\nThis CSV file contains 10,000 sales records:\n\n![CSV Data](https://russelwebber.github.io/xlslim-docs/html/_images/duckdb_sample_csv.png?raw=true)\n\nDuckDB allows the region, item type and total revenue for each sale to be extracted with a simple SQL SELECT. Notice how, just like the JSON example above, DuckDB allows the CSV file to be treated as a regular database table:\n\n\u003e SELECT Region, \"Item Type\", \"Total Revenue\" FROM '10000SalesRecords.csv' LIMIT 5\n\nPassing the SQL into the DuckDbQuery() function gives the following result:\n\n![CSV Query](https://russelwebber.github.io/xlslim-docs/html/_images/duckdb_csv_top5.png?raw=true)\n\nDuckDB has a user-friendly PIVOT statement that allows us to view the revenues in Asia and Europe broken down by item type:\n\n\u003e PIVOT '10000SalesRecords.csv' ON Region IN (\"Europe\", \"Asia\") USING sum(\"Total Revenue\") GROUP BY \"Item Type\" ORDER BY \"Item Type\"\n\n![Pivot CSV Query](https://russelwebber.github.io/xlslim-docs/html/_images/duckdb_csv_sales_pivot.png?raw=true)\n\nData from multiple sources can be combined in a single SQL query. We can combine the JSON and CSV data to show the total sales in the countries with the most Nobel laureates:\n\n\u003e WITH CountrySales AS\n\u003e (SELECT\n\u003e CASE WHEN Country='United States of America' THEN 'USA' ELSE Country END AS Country,\n\u003e Sum(\"Total Revenue\") AS Sales\n\u003e FROM '10000SalesRecords.csv'\n\u003e GROUP BY Country)\n\u003e SELECT\n\u003e cs.Country,\n\u003e SUM(cs.Sales) AS Sales,\n\u003e COUNT(\\*) AS \"Nobel Laureates\"\n\u003e FROM CountrySales cs\n\u003e INNER JOIN 'laureate.json' l\n\u003e ON cs.Country = l.bornCountry\n\u003e GROUP BY cs.Country\n\u003e ORDER BY \"Nobel Laureates\" DESC LIMIT 5\n\nThis SQL uses a common table expression (CTE) to create a CountrySales result set that is joined to the JSON data. Note the use of a CASE expression ensure the country names match in both source data sets:\n\n![Combined JSON CSV Query](https://russelwebber.github.io/xlslim-docs/html/_images/duckdb_csv_sales_joined_to_json.png?raw=true)\n\nFull details of DuckDB’s CSV capabilities are available in their documentation.\n\n## Querying Parquet files\n\nApache Parquet is an open source, column-oriented data file format designed for efficient data storage and retrieval. It provides efficient data compression and encoding schemes with enhanced performance to handle complex data in bulk.\n\nDuckDB has extensive support for efficient querying of Parquet files. DuckDB allows very large Parquet datasets to be queried (even data sets that do not fit into memory), multiple files can be queried in parallel.\n\nThe Parquet file, titanic.parquet, contains details of Titanic survivors.\n\nDuckDB allows the survival status, cabin class, sex and age of the passengers countries to be extracted with a simple SQL SELECT:\n\n\u003e SELECT Survived, Pclass, Sex, Age FROM 'titanic.parquet' LIMIT 5\n\nPassing the SQL into the DuckDbQuery() function gives the following result:\n\n![Parquet Query](https://russelwebber.github.io/xlslim-docs/html/_images/duckdb_parquet_top_survivors.png?raw=true)\n\nWe can now contrast the ages across cabin classes for survivors versus non-survivors:\n\n\u003e WITH Survivors AS\n\u003e (SELECT Pclass, Age, Sex\n\u003e FROM 'D:\\github\\xlslim-code-samples\\duckdb\\..\\data\\titanic.parquet'\n\u003e WHERE Survived=1)\n\u003e PIVOT Survivors ON Pclass USING AVG(Age) GROUP BY Sex\n\n![Pivot Query](https://russelwebber.github.io/xlslim-docs/html/_images/duckdb_parquet_survivors.png?raw=true)\n\n\u003e WITH Survivors AS\n\u003e (SELECT Pclass, Age, Sex\n\u003e FROM 'D:\\github\\xlslim-code-samples\\duckdb\\..\\data\\titanic.parquet'\n\u003e WHERE Survived=0)\n\u003e PIVOT Survivors ON Pclass USING AVG(Age) GROUP BY Sex\n\n![Pivot Query by sex](https://russelwebber.github.io/xlslim-docs/html/_images/duckdb_parquet_nonsurvivors.png?raw=true)\n\nGenerally, younger passengers were more likely to survive, with the curious exception of first class female passengers.\n\nFull details of DuckDB’s Parquet capabilities are available in their documentation.\n\n## Querying from remote locations\n\nDuckDB has functionality to directly query data located on https and in AWS S3.\n\nAs an example, the holdings.parquet file can be queried from https://duckdb.org:\n\n\u003e SELECT \\* FROM 'https://duckdb.org/data/holdings.parquet';\n\n![Query from URL](https://russelwebber.github.io/xlslim-docs/html/_images/duckdb_parquet_remote.png?raw=true)\n\nSimilarly we can attach to the DuckDB stations database in S3 and query the number of stations in each country:\n\n![Query from S3](https://russelwebber.github.io/xlslim-docs/html/_images/duckdb_duckdb_remote.png?raw=true)\n\nAccess to AWS S3 data usually requires credentials. See the DuckDB S3 API documentation for details about how to use secrets to provide credentials to S3.\n\nHopefully this gives a sense of the power of DuckDB! Please read the [DuckDB documentation](https://duckdb.org/docs/) for more information about DuckDB’s capabilities, including how to attach to SQLite, Postgress or indeed any ODBC databases.\n\n## Thanks\n\nxlDuckDb would not have been possible without the [ExcelDNA](https://github.com/excel-dna) and [DuckDB.NET](https://github.com/Giorgi/DuckDB.NET) projects.\n\nThe DuckDB query in Excel functionality was extracted from the commercial product [xlSlim](https://www.xlslim.com). If you need the same DuckDB functionality within a Digicert EV certificate signed addin then xlSlim is what you are looking for. xlSlim has a Windows .msi installer and is installable from [Chocolatey](https://community.chocolatey.org/packages/xlslim/). xlSlim's main purpose is to run Python functions within Excel as easily as possible.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frusselwebber%2Fxlduckdb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frusselwebber%2Fxlduckdb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frusselwebber%2Fxlduckdb/lists"}