Skip to main content

Files

Files can be uploaded to a Hex project and every project has its own file directory.

Upload files

You can upload up to 100 files (<2GB each) into a project using the Files tab in the sidebar. These files will be saved permanently as part of your project. The most common use case for this feature is uploading CSVs as source data.

To upload files, navigate to the Files icon on the left panel of the Logic View. Then drag your files into the Drop files here area or select your files from the browse files option.

Referencing uploaded files

From an uploaded CSV file, you can copy the DataFrame creation code, or create a SQL Cell with the CSV as its source.

Downloading files

You can download files from the file browser.

File directory

Every project has it's own directory, /hex, where files uploaded or downloaded in a project live. To see what files exist in your current project, check out the Files tab of the left sidebar or use this code in a Python cell:

import os

os.listdir()
caution

Any files created in a sub directory will not be persisted after the project's kernel has been restarted.

To programmatically delete all files in your project's directory, you can loop through the contents of your directory:

import os

for f in os.listdir():
os.remove(f)
caution

Deleted files are not recoverable. Be certain you want to delete all files in your project before using this code.

Files in different run contexts

Only files written in Logic sessions are persisted between runs of the project. Published apps and scheduled runs execute with different project run contexts, and persistent files are not supported for them. If you want to save a file during a scheduled run or published app session, you can write the data to an external source, such as your database, S3, or Google Drive.

Duplicate a project with uploaded files

When you duplicate a project, only files in the main directory (as visible in the Files tab) will be included in the new duplicate. If you have created any files in subdirectories, their contents will not be duplicated with the new project.

Render images

You can use a Markdown or Text cell to display images in your project.

You can also render locally uploaded images through the use of IPython.display, using code like the following in a Python cell:

from IPython.display import Image
Image(filename='file.png')