View and use attached files
Use the File viewer to view 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 Table viewer
Go to Attached data.
Double-click the file that you want to preview. Now the file content is displayed in the Table viewer pane to the right of the code editor.
(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.
Resize the File viewer
Hover over the left-side border of the File viewer pane. The mouse cursor will change to the resize cursor.
Hold down the left mouse button and drag the border to resize the pane.
Manage files in File viewer
Click the ellipsis in the upper right corner of the File viewer pane to open the action menu.
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.
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.
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 viewer.
Viewing file from stack trace
Viewing file with go to declaration option
Access an attached file from code
To refer to the file in your code, perform the following steps.
Go to Attached data.
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.
Right-click the file you want to use. Alternatively, you can click the ellipsis for the respective item.
Select Copy file path from the menu.
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