CSV Query is a free plugin to query CSV files using SQL in Notepad++. This plugin treats the CSV you open in it as a database table. Later, you can run SQL commands to query data inside. However, this plugin does not support complicated SQL operations. Using this plugin, you can only perform search, filter operations. If there is another delimiter in the CSV file other than comma, then this plugin can identify that automatically. After getting the SQL query’s result, you can even export that in CSV format again with a custom delimiter.
If you have a long CSV file and you want to search some records, then you can do it right from Notepad++. And the CSV Query plugin will help you do that. You can open any CSV file, invoke the plugin, and then start querying it using SQL.
This plugin, CSV Query basically creates an intermediary SQLite database and stores the input CSV data in that. After that, it uses that database through SQL commands that you run in it. And the result that it generates is in the form of table that you can copy or save to a new file. And if you are excited about this plugin, then I will suggest you to use a similar tool called Csvq. This is a command line tool that lets you execute SQL queries on CSV files and supports a lot of SQL command too.
How to Query CSV Files using SQL in Notepad++?
Step 1: You can simply get the CSV Query plugin (DLL File) from here. After that, you can move it to the ‘plugins’ folder in the installation directory of Notepad++.
Step 2: Open the target CSV file in Notepad++ now and then click on “Toggle query window” to activate it. After that, in the bottom, an SQL editor like interface will show up. You can then click on “Read File” button. It will then convert the CSV file into a table and you can now start running SQL queries on it.
Step 3: Just write your query in the box and then hit Enter key. It will execute the query and will show you the output. Later, you can opt to save the SQL result as CSV file. For that, just right click in the output area and select “Create new CSV…” option. It will ask you what delimiter you want to use and then it will open it in new tab of Notepad++. You can then save it as CSV, TSV or any other format you like.
The above steps should be enough to make you understand how this plugin works to query CSV files in Notepad++. If you have mastery over SQL, then you can easily use this plugin in Notepad++ and run SQL to search or filter data in a huge CSV file.
Final words
There are tons of Notepad++ plugins I have tried but CSV Query is surely quite a unique one. I use Notepad++ for opening almost all kind of text files including CSV or other data files. And I really liked the fact that I can easily run SQL inside Notepad++ to get data from CSV. If you want to try this new way to deal with CSV files in Notepad++ then the tutorial above will be helpful.