RubyMine 2023.2 Help

Files with delimiter-separated values

RubyMine 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 Install plugins.

  • The filename extension is associated with the text file type. For more information, see File type associations.

Edit CSV in the table view

  1. 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.

  2. In the Configure CSV Format for <file_name> 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.

For more information about the Configure CSV Format for <file_name> dialog, see the reference.

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.

CSV file in text and table view

Right-click any cell or column header to access available commands for modifying the table.

Sort data

  • 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.

Hide 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 Control+Alt+S and navigate to Tools | Database | Data Views and select the Automatically transpose tables. When this option is enabled, query results are not transposed.

Extract data from a table

If you need to use the data from the table elsewhere, RubyMine 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 Control+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.

The data editor context menu

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.

If the table data that you need to extract contains commas within the cells, RubyMine will honor the contents of such cells.

Export table data that contains commas within the cells

Copy data to another database

  1. Double-click a table to open it in the data editor.

  2. Click the Copy to Database icon on the toolbar.

  3. Specify the database, target schema (to create a new table with the exported data) or table (to add exported data to an existing table).

  4. Configure the data mapping and settings for the target table.

    Copy data to another database

Reference

Configure CSV Format for <file_name> dialog

This dialog opens when you select the Edit as Table command in the editor when viewing a file with delimiter-separated values.

This dialog contains the settings for converting delimiter-separated values (for example, CSV, TSV) into table data.

When you change settings, the preview changes correspondingly.

Item

Description

Formats

Select a template that successfully converts the file data into a table. You can change settings of predefined templates or add a new template. To add a template, click Add Format button (the Add Format icon).

Use the Add Format (App client expui general add), Remove Format (App general remove), Up (App actions previous occurence) and Down (App actions next occurence) buttons to create, delete and reorder the formats; Copy Format (the Copy Format icon) to create a copy of the selected format.

Value separator

Select or type the character that you want to use as a separator for values.

Row separator

Select or type the character that you want to use as a separator for rows.

Null value text

Select or type the text that you want to use if a cell contains the NULL value.

Add row prefix/suffix

Click the link and type a row prefix and suffix. Prefix and suffix are character sequences which in addition to the row separator indicate the beginning and end of a row.

Quotation

Each line in the area under Quotation is a quotation pattern. A quotation pattern includes:

  • Left: a quotation character that is inserted before a value.

  • Right: a quotation character that is inserted after a value.

  • Escape: an escape method or character for the cases when the quotation character is part of a value. The <duplicate> value means that if a quotation character occurs within a value, it is doubled. You can specify your own escape character.

If there is more than one pattern, the first pattern is used.

Use the Add (App client expui general add), Remove (App general remove), Up (App actions previous occurence) and Down (App actions next occurence) buttons to create, delete and reorder the patterns.

Quote values

Select when you want to enclose values within quotation characters.

  • Never: do not quote values.

  • When needed: quote a value if it contains the value or the row separator.

  • Always: quote all the values.

Trim whitespaces

Ignore or remove whitespace characters. If this checkbox is cleared, the whitespace characters are treated as parts of the corresponding values.

First row is header

Treat the first row as a row that contains column names.

First column is header

Treat the first column as a column that contains row names.

Last modified: 26 June 2023