A plugin to Notepad++ to parse different types of CSV files and display them in a table. The data is stored in a in-memory SQLite database, so you can write SQL queries against the data.
It tries to auto-detect separators, headers and column types. If it fails it asks you for it.
CsvQuery has a built-in SQLite engine. This is quite old, 3.7.7.1, so new features like common table expressions (WITH
subqueries) and common table expressions don't work.
There is no plans on updating this (unless someone else makes a new C# port of SQLite).
In principle, CsvQuery can also use SQL Server as backend. Then all features in SQL Server can be used right from CsvQuery. In practice, the ability of CsvQuery to connect to SQL Server has not been tested recently and is probably broken until further notice.
To use SQL Server you must first install SQL Server locally. Any version should work (there are free ones).
Make sure "Integrated security" is checked during install of SQL Server (it is by default).
Then go into CsvQuery settings (Plugins -> CsvQuery -> Settings)
- Set "StorageProvider" to "MSSQL"
- Set "Database" to "CsvQueryDB"
Now click "Read File" again, and it will use SQL Server syntax in CsvQuery.
Another option is to use an external SQLite tool with a more modern SQLite engine.
To do this, change the CsvQuery setting "Database" to a filename instead of ":memory:".
The next time you click "Read file" this file will be created as a standard SQLite file, and can be queried with the external tool.
This package as a whole is licensed under the GPL v3. See gpl-3.0.txt
The CsharpSqlite code is licensed under MIT license (which is apparently GPL v3 compatible). See CsharpSqlite\License-CsharpSqlite-MIT.txt
- Support for more types of CSV files (more test cases, basically)
- Optimizations
CSV Query detects the separator by calculating the variance in occurrence of characters on each line, then chose the one that seems best, preferring one of comma, semicolon, pipe or tab. It's certainly not perfect, but it handles all the files I regularly work with, which is why I wrote the plugin in the first place.
If the first line is "significantly different" from the rest it assumes the first line is a header and use it for the column names in the database.
Prior to 2023, this plugin did not work correctly with files that had CR (Macintosh) newlines, and only worked if the line terminator was LF (Unix) or CRLF (Windows).
Base for making Notepad++ plugins in C#
https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net Licensed under GPL v3
SQLite database rewritten in C#. I basically copied the whole codebase into CSV Query to get a single DLL (and to mess around with it a bit).
https://code.google.com/p/csharp-sqlite/
MIT Licence