CSVFileView

CSVFileView v2.52
Copyright (c) 2011 - 2021 Nir Sofer
Web site: https://www.nirsoft.net

Description

CSVFileView is a simple CSV file viewer/converter utility that allows you to easily view the content of CSV or tab-delimited file created by NirSoft utilities or by any other software, in a simple table viewer. You can sort the lines according to one of the fields, remove unwanted fields and change their order, and then save the result back into CSV file, tab-delimited file, XML file, or HTML report.

Known Limitations

  • CSVFileView cannot load extremely large csv files.

Versions History

  • Version 2.52:
    • Added option to change the sorting column from the menu (View -> Sort By). Like the column header click sorting, if you click again the same sorting menu item, it'll switch between ascending and descending order. Also, if you hold down the shift key while choosing the sort menu item, you'll get a secondary sorting.
  • Version 2.51:
    • Fixed CSVFileView to set the focus on the csv viewer when a file is loaded.
    • Fixed the font size of the properties window in high DPI mode.
  • Version 2.50:
    • Updated to work properly in high DPI mode.
    • Added 'Put Icon On Tray' option.
  • Version 2.48:
    • Fixed the 'Automatic Numeric Sorting' feature to work according to the Decimal separator.
    • Fixed CSVFileView to open properly a file that has only one column and without any delimiter.
  • Version 2.47:
    • Fixed the automatic date sorting to work with the following format: 01-01-2020T10:20:30
    • Fixed bug: In some files, CSVFileView detected non-English character as the delimiter.
  • Version 2.46:
    • Added 'Copy Clicked Cell' option to the right-click context menu, which copies to the clipboard the text of cell that you right-clicked with the mouse.
  • Version 2.45:
    • In filter expressions - you can now specify the column name without spaces, for example - instead of 'Device Name' CONTAINS 'USB' , you can use this expression: DeviceName CONTAINS 'USB'
    • Added 'Save All Items' option (Shift+Ctrl+S).
  • Version 2.43:
    • Fixed the stdin feature so you can open CSVFileView with the stdout from another another program (Including many NirSoft tools).
    • For example, the following command opens CSVFileView with USB devices table sent to stdout by USBDeview tool: (You have to run it from command-prompt window)
      USBDeview.exe /scomma "" | CSVFileView.exe /Load stdin:
  • Version 2.42:
    • Added 'Default Column Names' option, which controls the column names when the 'First Line Contains Column Names' option is turned off: Column1, Column2... or 1,2,3... or A,B,C...
  • Version 2.41:
    • The Explorer Context Menu item is now displayed with icon of CSVFileView (Only when the .exe is on local drive).
    • Fixed CSVFileView to display an error message in the status bar when it fails to open a file (This feature was added on version 2.16, but it didn't work properly...)
  • Version 2.40:
    • When exporting items with multiline field to tab-delimited file (Including the 'Copy Selected Items' option), CSVFileView now put the multiline field in quotes to ensure that the exported data will be displayed properly in Excel and other programs.
  • Version 2.39:
    • Added .tsv extension (Tab Separated Values) to the open dialog-box.
  • Version 2.38:
    • Replaced the font on the properties window to ensure it can display all characters.
  • Version 2.37:
    • Fixed bug: CSVFileView failed to display properly csv lines with very long field.
  • Version 2.36:
    • Added 'Always Use Advanced Open Settings' option (Under the Options menu). When it's turned on, CSVFileView will open all files according to the last settings you choose in the 'Advanced Open' window.
  • Version 2.35:
    • Added new quick filter options: 'Find records with all words (space-delimited list)' and 'Find records with all strings (comma-delimited list)'
    • Added new quick filter combo-box: 'Show only items match the filter' and 'Hide items that match the filter'.
  • Version 2.32:
    • Added 'Add Thousands Separator' option (Under the Options menu). When it's turned on, CSVFileView automatically adds thousands separator to numeric values (Be aware that this feature only works with whole numbers)
    • Fixed bug: 'Copy Selected Items' worked improperly when setting the 'Unicode/Ascii Save Mode' to 'Always UTF-8'.
  • Version 2.31:
    • Added 'Align Numeric Columns To Right' option (Under the Options menu).
  • Version 2.30:
    • Added 'Quick Filter' feature (View -> Use Quick Filter or Ctrl+Q). When it's turned on, you can type a string in the text-box added under the toolbar and CSVFileView will instantly filter the csv table, showing only lines that contain the string you typed.
  • Version 2.29:
    • Fixed bug: CSVFileView crashed when using the find option while the last item was selected.
  • Version 2.28:
    • Fixed the filter text-box to handle Ctrl+A (Select All).
  • Version 2.27:
    • Added 'Auto Detect Remark Lines' option. When it's turned on, CSVFileView tries to detect and skip the first remark lines in a file.
  • Version 2.26:
    • Added 'New CSVFileView Instance' under the File menu, for opening a new window of CSVFileView.
  • Version 2.25:
    • Fixed bug: CSVFileView displayed wrong items when opening a file with a filter turned on.
    • Fixed bug: CSVFileView failed to load properly a filter string from the .cfg file that had single quote in the first and last characters.
    • Fixed bug: 'Auto Size Columns' option was disabled immediately after loading a file.
  • Version 2.22:
    • Reduced the memory footprint while loading UTF8 or Ascii file.
  • Version 2.21:
    • The properties window is now resizable.
    • Added </tr> </td> closing tags to the HTML files.
  • Version 2.20:
    • Added 'Display Filter' option (F2). The display filter is somewhat similar to the SQL WHERE clause, for example... The following filter will instruct CSVFileView to display only lines with 'Yes' value in the Connected column and the 'Device Name' column contains a 'USB' string:
      Connected = 'Yes' AND 'Device Name' CONTAINS 'USB'
    • Added 'Load Filter' option to the 'Advanced Open' window. It's similar to the 'Display Filter' feature, but instead of filtering the file after it's already loaded , the load filter skip items during the loading process, so the file will be loaded faster and CSVFileView will consume less memory.
    • Added 'First line contains column names' and 'Automatically detect the delimiter and quotes characters' options to the 'Advanced Open' window.
    • Added /aload command-line option, for loading a file according to the 'Advanced Open' settings.
    • You can now specify any variable inside the CSVFileView.cfg file as a command-line parameter, for example... In order to turn off the 'First Line Contains Column Names' option:
      CSVFileView.exe /FirstLineColumnNames 0
  • Version 2.16:
    • CSVFileView now displays an error message in the status bar when it fails to open a file.
  • Version 2.15:
    • Added option to save the text/xml/csv/html files in UTF-8 (Options -> Unicode/Ascii Save Mode -> Always UTF-8 )
  • Version 2.10:
    • Added 'Enable String Interning' option. When it's turned on, CSVFileView tries to detect repeating column values, and store them in memory only once, instead of multiple times. This option can be useful if you load a large file with many repeating strings, because the memory consumption of CSVFileView will decrease dramatically. However, the loading process will be slower than normal.
    • Fixed issue: When loading a large file, some actions, like selecting items and copying selected items to the clipboard were very slow.
    • When the 'After Loading File - Sort By' option is set to 'Original File Order', the loading process will be faster. (In previous versions, CSVFileView called the sort function when it's not really needed...)
    • Added 64-bit version.
  • Version 2.06:
    • Added /sort command-line option (For using with the save command-line options - /stab, /scomma, /shtml ...)
  • Version 2.05:
    • Added option to export to JSON file.
  • Version 2.02:
    • Added 'Add Byte Order Mark To Unicode Files' option. If you turn it off, CSVFileView won't add Byte Order Mark (BOM) when saving to Unicode file.
  • Version 2.01:
    • Fixed bug: CSVFileView failed to remember the last size/position of the main window if it was not located in the primary monitor.
  • Version 2.00:
    • Added new file type in 'Save Selected Items' option: Custom Delimited File. You can set the desired delimiter and quote characters of this file type using 'Custom Delimited File Settings' (Ctrl+F9)
    • Added 'Always On Top' option.
  • Version 1.96:
    • Added secondary sorting support: You can now get a secondary sorting, by holding down the shift key while clicking the column header. Be aware that you only have to hold down the shift key when clicking the second/third/fourth column. To sort the first column you should not hold down the Shift key.
  • Version 1.95:
    • Fixed to find the correct item when typing the string you want to search into the main List View. (This feature stopped working on version 1.85)
  • Version 1.93:
    • Added 'Keep Columns Size/Order on Refresh' option.
  • Version 1.92:
    • Added 'Clear Recent Files List' option.
  • Version 1.91:
    • Added /cfg command-line option, which instructs CSVFileView to use a config file in another location instead if the default config file, for example:
      CSVFileView.exe /cfg "%AppData%\CSVFileView.cfg"
  • Version 1.90:
    • Added 'Copy Sorted Column Data' option, which copies to the clipboard the text of all selected items, but only the column that is currently sorted.
    • Added 'Select All' and 'Deselect All' options in the 'Choose Columns' window.
    • CSVFileView now detects the date/time of Apache Web server log (For example: 29/Jul/2013:10:38:57 -0400)
    • Added option to specify space character ( /s ) as delimiter in the 'Advanced Open' window.
  • Version 1.87:
    • Added 'Original File Order - Descending' and 'First Column - Descending' to the 'After Loading File - Sort By' option.
  • Version 1.86:
    • While loading large files, CSVFileView now displays progress information in the status bar.
  • Version 1.85:
    • CSVFileView now loads large files much faster and with less memory usage ( /FastMode command-line option is not needed anymore. If from some reason you want to run it in the previous mode, you can execute CSVFileView with /NoFastMode command-line option).
  • Version 1.82:
    • Fixed bug: When 'Auto Refresh' option was turned on, trying to load a large csv file caused CSVFileView to hang and to consume extreme amount of memory.
  • Version 1.81:
    • Added 'Beep On New Line' option. (Works only on partial refresh)
  • Version 1.80:
    • When selecting a single line, the line number in the original file is now displayed in the status bar (Be aware that empty lines are not counted by CSVFileView)
    • Added option to display the csv lines with different font (Options -> Select Another Font).
  • Version 1.76:
    • Added 'Scroll To Bottom On New Line' option. If this option is turned on, a parial refresh is made, and new lines were added since the last refresh, then the List-View is scrolled to the bottom in order to show you the added new lines.
  • Version 1.75:
    • Added 'Partial Refresh' option (Ctrl+F5), which makes a smooth refresh, without reloading the entire table. However, Partial Refresh will not work properly if you add/remove columns or change their position.
    • Added 'Auto Refresh Mode' which allows you to choose how to refresh when the 'Auto Refresh' option is turned on - Partial Refresh or Full refresh.
  • Version 1.71:
    • Fixed bug: CSVFileView crashed when opening a file with large amount of columns.
  • Version 1.70:
    • The properties window now supports multiple pages, for handling files with large amount of columns.
  • Version 1.67:
    • Fixed bug: When opening a file with /load command-line option, CSVFileView sorted the list by the first column, even if the 'Sort by original file order' option was selected.
  • Version 1.66:
    • Added 'Load only from line number...' option (In 'Advanced Open' window)
    • Fixed issue: The properties and the other windows opened in the wrong monitor, on multi-monitors system.
  • Version 1.65:
    • Added option to load last xx lines or first xx lines from the file. (In 'Advanced Open' window)
    • Fixed issue: If you open a file with 'Advanced Open' window and then do a refresh (F5) CSVFileView now loads the file with the last 'Advanced Open' settings. In previous versions, it opened the file with the default settings.
  • Version 1.60:
    • Added 'Open Text In Clipboard' option (Ctrl+F7), which allows you to open csv/tab-delimited text that you copied to the clipboard.
    • You can also specify 'Clipboard:' as a filename in the 'Advanced Open' window or from command-line (/Load Clipboard:) , in order to grab the csv/tab-delimited text from the clipboard.
    • The 'Automatic Date Sorting' feature now also works with combination of date and time, for example: 22/03/2011 21:34:25
  • Version 1.55:
    • Added 'After Loading File - Sort By' option, which allows you to choose how to sort the file after loading it into CSVFileView - by original file order or by the first column.
    • Added 'Automatic Column Size' option, which allows you to choose how to set the columns size after loading a file - Fixed Size (Default), By Column Values Only, or By Column Values+Headers.
    • You can now load a file from stdin, by specifying stdin: as a filename, for example:
      CSVFileView.exe /Load stdin: < c:\temp\myfile.csv
  • Version 1.51:
    • Added 'Auto Size Columns+Headers' option, which allows you to automatically resize the columns according to the row values and column headers.
  • Version 1.50:
    • Added 'Open Recent File' menu (Under the File menu), which allows you to easily open the last 10 csv files that you have previously opened.
  • Version 1.45:
    • Added new mode that allows you to load large .csv files much faster and with less memory usage. This mode is currently in Beta, so in order to activate it, you have to run CSVFileView with /FastMode command-line option:
      CSVFileView.exe /FastMode
      If you use CSVFileView for loading large files, it's highly recommended that you try this mode and report about any bug/problem you discover.
  • Version 1.40:
    • Added 'Hide Selected Lines' option (Ctrl+H)
  • Version 1.35:
    • Added 'Advanced Open' option, which allows you to specify the delimiter and quotes characters of the file you want to load. This option is useful for files that their delimiter character is not detected correctly by CSVFileView.
  • Version 1.30:
    • Added 'Allow MultiLine Fields' option. When it's turned on, CSVFileView will be able to load csv file containing field values with multiple lines.
    • Added option to stop the loading process of csv file, by clicking the 'Stop' menu item, or by pressing the Esc key.
  • Version 1.25:
    • Added 'Auto Refresh' option. When it's turned on, CSVFileView automatically reloads the file when a change in the size/modified time of the file is detected.
    • Added 'Descending Sort By Original Order' option (Ctrl+F8)
    • When using the refresh option (F5), the lines are now sorted according to the last sorting you chose (by clicking the column headers).
  • Version 1.20:
    • Added 'Unicode/Ascii Default Open Mode' option, which instructs CSVFileView how to open a file without a Unicode signature (byte order mark) - as Ascii (the default), as Unicode, or as UTF8.
  • Version 1.15:
    • Added 'Automatic Date Sorting' option. Be aware that date sorting doesn't work with all date formats.
  • Version 1.12:
    • Fixed the problem with negative numbers sorting.
  • Version 1.11:
    • Fixed bug: CSVFileView didn't display all columns if the first line had one or more empty fields.
  • Version 1.10:
    • Added /load command-line option, which allows you to specify the file to open from command-line.
    • Added support for save command-line options (/shtml , /sxml, and so on), which can be used together with /load command-line option for converting the csv file into xml/html/tab-delimited file.
    • Added 'Explorer Context Menu' option. When this option is enabled, 'Open With CSVFileView' menu item is added when you right click on a text file.
    • Automatic delimiter detection - When CSVFileView cannot find a comma or tab character in the first line, it tries to automatically detect the right delimiter character and parse the file with it.
    • Added support for loading UTF8 files.
  • Version 1.00 - First release.

Using CSVFileView

CSVFileView doesn't require any installation process or additional dll files. In order to start using it, simply run the executable file - CSVFileView.exe
After running CSVFileView, you can open the desired CSV/Tab-Delimited file by using the 'Open CSV\Tab-Delimited File' option (Ctrl+O) or by dragging the file from Explorer into the main window of CSVFileView.
If the first line of the CSV/Tab-Delimited file doesn't contain the column names, you should turn off the 'First Line Contains Column Names' option (Under the Options menu) before opening the file.

After opening the desired file, you can do the following actions:

  • Sort the lines by one of the fields, simply by clicking the right column header. If the column values are numeric, CSVFileView automatically makes a numeric sorting instead of string sorting.
  • Remove one or more columns or change their position by using the 'Choose Columns' window (F7). You can also change the position of the columns by dragging the column headers into another position.
  • Select one or more lines, or select all lines (Ctrl+A), and then saving them into csv, comma-delimited, XML, or HTML file, by using the 'Save Selected Items' option (Ctrl+S). You can also press Ctrl+C to copy the selected lines into the clipboard, and then paste them into Excel.

More Options

  • Unicode/Ascii Save Mode: By default, CSVFileView saves all files in Unicode, except of csv file, which is saved as Ascii. The reason for saving csv files as Ascii is... Microsoft Excel. That's because Microsoft Excel doesn't open properly csv files that are saved as Unicode.
    You can change the default behavior, by going to Options -> Unicode/Ascii Save Mode, and then choosing the desired save mode - Ascii or Unicode.
  • Add Header Line To CSV/Tab-Delimited File: When this option is turned on, and you export the selected lines into csv/tab-delimited file, the first added line contains the column/field names.
  • First Line Contains Column Names: When this option is turned on, CSVFileView uses the first line of the opened csv/tab-delimited file as the column names list.
  • Automatic Numeric Sorting: When this option is turned on, CSVFileView automatically uses numeric sorting when numeric values are detected.

Using Quick Filter

Starting from version 2.30, there is a 'Quick Filter' feature that allows you to type one or more strings and instantly filter the file, showing only the lines contain the strings you typed.
In order to activate and deactivate this feature, go to View -> Use Quick Filter or simply press Ctrl+Q. After this feature is activated, you can type the desired filtering string in the text-box located under the toolbar and CSVFileView will instantly filter the result. You can choose to filter by only one string, multiple strings (comma delimited), or multiple words (space delimited). You can also choose whether to scan all columns or only the visible columns.

Using Filters (For Advanced Users)

Starting from version 2.20, CSVFileView allows you to apply a filter for viewing only the lines you need.
There are 2 places that you can use filter:
  • Display Filter window (F2): The Filter is applied after the entire file is already loaded. When using this option, you can easily remove the filter and view again all items by switching the 'Use Display Filter' option (Ctrl+F2) or you can press F2 again and use another filter.
  • 'Advanced Open' window (Load Filter): The filter is applied while loading the file, so all lines that are filtered out by your filter are not loaded at all. If you filter out a lot of lines with the load filter, then the file will be loaded much faster and CSVFileView will consume less memory.

A filter string of CSVFileView is somewhat similar to the SQL WHERE clause. CSVFileView currently supports the following operators:
= != > < >= <= LIKE CONTAINS BEGINSWITH ENDSWITH NOT AND OR

Here's some examples and rules for using the CSVFileView filters:

  • The following filter instructs CSVFileView to display only items with 'Yes' in 'Connected' column and 'No' in 'Disabled' column:
    Connected = 'Yes' And Disabled = 'No'
  • Display only items with value different than 'Yes' in 'Connected' column and with 'SerialNumber' column begins with '12' string:
    Connected != 'Yes' And SerialNumber BEGINSWITH '12'
  • Display only items the their Filename column begins with 'f' and has more 7 characters (You can use ? and * in LIKE operator, like the wildcard of Windows):
    Filename LIKE 'f???????'
  • Display only items the their Filename column contains 'abc' string or 'qwe' string.
    Filename CONTAINS 'abc' OR Filename CONTAINS 'qwe'
  • When a column name has a space character, you must put it in quotes, for example:
    'Device Name' CONTAINS 'USB'
  • Starting from version 2.45, you can specify the column name without spaces, and then the quotes are not needed, for example:
    DeviceName CONTAINS 'USB'
  • When there are no column names, you can use 'Column1' as the first column, 'Column2' for the second column, and so on... For example:
    Column1 LIKE '??34*' and Column4 = 'Yes'
  • You can use the NOT operator to reverse the result, for example... This filter will display items that don't contain 'txt' string in the Filename column:
    Filename NOT CONTAINS 'txt'
  • You can use the > < >= <= operators with numeric values in order to filter by a range of numbers. For example, in order to display only records with ID value between 100 and 200:
    ID >= 100 and ID <= 200
  • Starting from version 2.45, you can also use the && and || operators instead of and/or, for example:
    ID >= 100 && ID <= 200
  • When mixing and/or in the same filter, you must use parentheses, for example:
    (Column1 = '3' AND Column4 = 'No') OR (Column1 = '4' AND Column4 = 'Yes')

You can also apply a load filter from command-line by using /aload with other command-line options to set the 'Advanced Open' settings, for example:
CSVFileView.exe /AutoDetectChars 1 /UseLoadFilter 1 /LoadFilterStr "Column1 LIKE 'a*' " /aload C:\temp\myfile.csv
CSVFileView.exe /AutoDetectChars 1 /UseLoadFilter 1 /LoadFilterStr "Column1 = 'Yes' and Column2 = 'No' " /aload C:\temp\myfile.csv /scomma c:\temp\filtered_file.csv

Opening Web Server Log File

With CSVFileView, you can also open a log file of Apache or other Web server that generates a log file in the same format. In order to do that, you should turn off the 'First Line Contains Column Names' option, open the 'Advanced Open' window (Ctrl+Shirt+O), type \s (space character) in the delimiter field, and "[] in the quotes field. Choose the log file to open and then press Ok.

Command-Line Options

/load <Filename> | Start CSVFileView with the specified csv/tab-delimited file.
/aload <Filename> | Start CSVFileView with the specified csv/tab-delimited file. The file will be loaded according to the 'Advanced Open' settings.
/cfg <Filename> | Start CSVFileView with the specified configuration file. For example: CSVFileView.exe /cfg "c:\config\csv.cfg" CSVFileView.exe /cfg "%AppData%\CSVFileView.cfg"
/stext <Filename> | Save the loaded csv/tab-delimited file into a regular text file.
/stab <Filename> | Save the loaded csv/tab-delimited file into a tab-delimited text file.
/scomma <Filename> | Save the loaded csv/tab-delimited file into a comma-delimited text file (csv).
/stabular <Filename> | Save the loaded csv/tab-delimited file into a tabular text file.
/shtml <Filename> | Save the loaded csv/tab-delimited file into HTML file (Horizontal).
/sverhtml <Filename> | Save the loaded csv/tab-delimited file into HTML file (Vertical).
/sxml <Filename> | Save the loaded csv/tab-delimited file into XML file.
/scustom <Filename> | Save the loaded csv/tab-delimited file into a custom delimited text file.
/sjson <Filename> | Save the loaded csv/tab-delimited file into a JSON file.
/sort <column> | This command-line option can be used with other save options for sorting by the desired column. The <column> parameter can specify the column index (0 for the first column, 1 for the second column, and so on) or the name of the column, like "Description" and "User Name". You can specify the '~' prefix character (e.g: "~Description") if you want to sort in descending order. You can put multiple /sort in the command-line if you want to sort by multiple columns. Examples: CSVFileView.exe /Load "c:\temp\1.csv" /shtml "c:\temp\1.html" /sort 2 /sort ~1 CSVFileView.exe /Load "c:\temp\1.csv" /shtml "c:\temp\1.html" /sort "~Value" /sort "Description"

In addition to the above command-line options, you can also specify any variable inside the CSVFileView.cfg file as a command-line parameter, for example... In order to turn off the 'First Line Contains Column Names' option:
CSVFileView.exe /FirstLineColumnNames 0

Translating CSVFileView to other languages

In order to translate CSVFileView to other language, follow the instructions below:
  1. Run CSVFileView with /savelangfile parameter:
    CSVFileView.exe /savelangfile
    A file named CSVFileView_lng.ini will be created in the folder of CSVFileView utility.
  2. Open the created language file in Notepad or in any other text editor.
  3. Translate all string entries to the desired language. Optionally, you can also add your name and/or a link to your Web site. (TranslatorName and TranslatorURL values) If you add this information, it'll be used in the 'About' window.
  4. After you finish the translation, Run CSVFileView, and all translated strings will be loaded from the language file.
    If you want to run CSVFileView without the translation, simply rename the language file, or move it to another folder.

License

This utility is released as freeware. You are allowed to freely distribute this utility via floppy disk, CD-ROM, Internet, or in any other way, as long as you don't charge anything for this and you don't sell it or distribute it as a part of commercial product. If you distribute this utility, you must include all files in the distribution package, without any modification !

Disclaimer

The software is provided "AS IS" without any warranty, either expressed or implied, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. The author will not be liable for any special, incidental, consequential or indirect damages due to loss of data or any other reason.

Feedback

If you have any problem, suggestion, comment, or you found a bug in my utility, you can send a message to nirsofer@yahoo.com