DZone
Use csvsql or q, command-line tools that allow direct execution of SQL-like queries on CSVs/TSVs (and any other tabular text files) if your query is very simple. If you want to do more complex queries or even want to query excel files directly, try esProc.
How to Use
Execute SQL in esProc
You can easily export the SQL query result to a new Excel file or text file.
Source: DZone