|
| 1 | +# Adding Files to Noteable |
| 2 | + |
| 3 | +When working with data files (such as CSV files containing experimental results), you need to get those files into your Noteable environment before you can read them with Python. |
| 4 | + |
| 5 | +## Uploading Files from Your Computer |
| 6 | + |
| 7 | +To upload a file from your computer to Noteable: |
| 8 | + |
| 9 | +1. Click the upload button (↑ icon) in the toolbar at the top of the file browser |
| 10 | +2. Select the file from your computer |
| 11 | +3. The file will appear in your current directory |
| 12 | + |
| 13 | +**Alternative method:** You can also drag and drop files directly from your computer into the Noteable file browser. |
| 14 | +```{note} |
| 15 | +Make note of which directory your file is uploaded to. You'll need to use this path when reading the file in Python. |
| 16 | +``` |
| 17 | + |
| 18 | +## Downloading Files from the Internet |
| 19 | + |
| 20 | +If you have a direct URL to a data file (for example, a CSV file hosted on GitHub), you can download it directly into Noteable: |
| 21 | + |
| 22 | +1. Go to **File > Open from URL...** |
| 23 | +2. Paste the URL of the file |
| 24 | +3. Click **Open** |
| 25 | + |
| 26 | +The file will be downloaded to your current directory. |
| 27 | + |
| 28 | +### Example URLs |
| 29 | + |
| 30 | +For CSV files on GitHub, make sure to use the "raw" URL. For example: |
| 31 | +- Wrong: `https://github.com/user/repo/blob/main/data.csv` |
| 32 | +- Correct: `https://raw.githubusercontent.com/user/repo/main/data.csv` |
| 33 | + |
| 34 | +## Finding Your Files |
| 35 | + |
| 36 | +Once uploaded or downloaded, files appear in the file browser on the left side of the Noteable interface. To use a file in your Python code, you reference it by its filename (if it's in the same directory as your notebook) or by its path. |
| 37 | +```python |
| 38 | +import numpy as np |
| 39 | + |
| 40 | +# If the file is in the same directory as your notebook: |
| 41 | +data = np.loadtxt('mydata.csv', delimiter=',') |
| 42 | + |
| 43 | +# If the file is in a subdirectory: |
| 44 | +data = np.loadtxt('data/mydata.csv', delimiter=',') |
| 45 | +``` |
0 commit comments