Datalore 2024.5 Help

View, edit, and use attached files

Use the File editor to view and edit the content of attached files from Attached data. For table-like content, by default, it displays files as tables. You can also switch to the text editor view.

Open an attached file in the file editor

  1. Go to Attached data.

    • To open a file attached to the notebook or a file from the respective workspace, stay on the Files tab.

    • To open a file from an attached cloud storage, switch to the Cloud storages tab and click the cloud storage to open it in detail view.

  2. Double-click the file that you want to open in the editor. Now the file content is displayed in the file editor on the right side of the code editor.

  3. (Optional) To sort the values in a column, click the up/down arrow icon to the right of the column header.

In the image below, you can see a .csv file opened in the File viewer. The view of the table is vertically and horizontally scrollable. It is also paginated based on a limit of 50 rows per page.

Viewing attached csv file as table

Resize the file editor

  1. Hover over the left-side border of the File editor pane. The mouse cursor will change to the resize cursor.

  2. Hold down the left mouse button and drag the border to resize the File editor pane.

Manage files in the File editor

  1. Click the ellipsis in the upper right corner of the File editor pane to open the action menu.

  2. Select one of the following actions:

    • Switch to text editor to view the file as text.

    • Download to export the file to your file system.

    • Copy file path to copy the path to the file location in Attached data.

    • Delete to delete the file from Attached data.

    • Rename to rename the attached file. After you select the action, the cursor is placed in the file name field. Optionally, you can click the file name field without opening the action menu.

File viewer menu

Edit tables in File viewer

You have the following options:

  • To change a value in a table cell, double-click the cell and enter the new value. After you shift focus from the cell, it saves the new value.

  • To add a row or a column at the end of the table, right-click anywhere on the table and select Append row or Append column.

  • To delete a column or a row, right-click the respective table element and select Delete row or Delete column.

    Action menu in File viewer

Viewing attached files from code cells

Datalore allows you to open attached files from stack trace or when using the Go to declaration option. Click the file, and you will see it in the File editor.

Viewing file from stack trace

Attached file opened from stack trace

Viewing file with go to declaration option

Viewing attached file for function declaration

Access an attached file from code

To refer to the file in your code, perform the following steps.

  1. Go to Attached data.

  2. Navigate to the required file:

    • For the notebook attached files, stay on the Files tab.

    • For the respective workspace files, expand the list of workspace files on the Files tab.

    • For a cloud storage, switch to the Cloud storages tab and click the required cloud storage to expand it in detail view.

  3. Right-click the file you want to use. Alternatively, you can click the ellipsis for the respective item.

    Opening file menu
  4. Select Copy file path from the menu.

  5. Paste the copied file path into your code.

    For example, the code below uses a file called 'libraries_by_python_version.csv'.

    libraries = pd.read_csv('libraries_by_python_version.csv') libraries

Query attached files

Use SQL cells to query tables in attached .csv or SQLite database files. Refer to this topic for more details.

Keywords

upload files, attach files, add files, data sources, data, data files, notebook attachments, notebook files, attached files, manage files, view files, view attachments

Last modified: 25 November 2024