CSV and TSV files as tables
CLion lets you edit delimited text files (CSV, TSV, and other delimiter-separated formats) as tables. The data editor is available if the following conditions are satisfied:
The bundled Database Tools and SQL plugin is enabled. For more information, see Plugins.
The filename extension is associated with the text file type. For more information, see File types.
Edit CSV in the table view
Right-click inside a delimited text file and then click Edit as Table. Also, you can click the Edit as Table icon in the editor.
In the dialog that opens, specify format settings and click OK.
The dialog has three predefined formats (CSV, TSV, and Pipe-separated) and lets you create a custom format. For example, you may require comma-separated values with semicolons as row separators.
Two tabs for the file become visible: Text and Data. Text presents data in a text format, Data in a table format.
The data editor opens in a separate tab based on the settings you configure. If you want to use different format settings, repeat the previous procedure and open the data editor again.
Right-click any cell or column header to access available commands for modifying the table.
Click the column header to toggle between sorting directions: ascending, descending, and initial unsorted state.
The number indicates the sorting level (priority), when you sort by multiple columns.
Right-click the column header and then click Hide column.
To see the list of all columns, right-click any column header and then click Column List. Names of hidden columns are shown struck through. To toggle between hidden and shown state of a column, select it in the list and press Space.
Enable coding assistance
Right-click the column header or individual cell and then click Edit As to select a language and provide coding assistance when modifying the contents.
Transpose a table
Right-click any cell in a table and then click View as | Transpose to switch rows and columns.
To make this mode a default for tables and views, open settings by pressing Ctrl+Alt+S and navigate to Automatically transpose tables. When this option is enabled, query results are not transposed.and select the
Extract data from a table
If you need to use the data from the table elsewhere, CLion provides several possibilities to copy or save it.
Copy selected cells to the clipboard
Right-click the selected cells and then click Copy or press Ctrl+C.
Copy all table data to the clipboard
Right-click any cell in the table, point to Export Data, and then click To Clipboard.
Save all table data to a file
Right-click any cell in the table, point to Export Data, and then click To File.
You can configure how extracted data is converted into text using predefined output formats, customized formats, and scripts. To configure the output for extracted data, right-click any cell in the table and select Choose Data Extractor.
In this menu, you can select the output format (for example, as SQL
INSERT statements, HTML table, or in CSV format) or a script that converts data into a specific format.
Copy data to another database
Double-click a table to open it in the data editor.
Click the Copy to Database icon on the toolbar.
Specify the database, target schema (to create a new table with the exported data) or table (to add exported data to an existing table).
Configure the data mapping and settings for the target table.