PyCharm 2021.1 Help

Edit as Table: <file_name> Format Dialog

You can open a text file that containing delimiter-separated values (for example, CSV, TSV) is open in the editor, this dialog opens when you select the Edit as Table command.

Edit CSV and TSV files in table mode

  1. Open a file with delimiter-separated values in the editor.

  2. Select a fragment of the file or the whole file.

  3. Right-click the selection and navigate to Edit as Table.

  4. In the Edit as Table dialog, customize the settings to receive the desired result in the right preview pane.

  5. Click OK.

    Edit CSV and TSV files in table mode

In the Import File dialog, you can specify import settings for formats with delimiter-separated values. You can use the predefined templates or create a new one.

This dialog lets you specify the settings for converting table data into delimiter-separated values formats (for example, CSV, TSV) and vice versa.

Conversion settings

When you change import settings, the import preview changes correspondingly.

ItemDescription
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, press Add Format button (the Add Format button).

To save changes, click the Save icon the Save icon and select one of the following options:

  • Save Changes: save changed settings of the current template are saved.

  • Save As: create a new template and save settings of the new template.

  • Save All: save changes in all templates.

Use Icons general add, Icons general remove, Icons actions previous occurence and Icons actions next occurence to create, delete and reorder the formats; Icons actions copy to create a copy of the selected format.

Value separatorSelect or type the character that you want to use as a separator for values.
Row separatorSelect or type the character that you want to use as a separator for rows.
Null value textSelect or type the text that you want to use if a cell contains the NULL value.
Add row prefix/suffixClick 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 (see Quote values). 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 Icons general add, Icons general remove, Icons actions previous occurence and Icons actions next occurence 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 whitespacesIgnore or remove whitespace characters. If this checkbox is cleared, the whitespace characters are treated as parts of the corresponding values.
First row is headerTreat the first row as a row that contains column names.
First column is headerTreat the first column as a column that contains row names.
Last modified: 08 March 2021