Use ChatGPT with Google Colab without losing the files your notebook needs

If a saved Colab notebook reopens but read_csv cannot find its input, give ChatGPT the exact path and the runtime's current file listing. Saving the notebook preserves its document; it does not preserve every file uploaded to its temporary runtime. Re-upload or restore the intended input before changing a calculation that may already be correct.

You can copy a permitted code cell and its error between Colab and ChatGPT without installing an extension. That manual workflow does not give ChatGPT access to your Google account or running notebook. State the task and supply the relevant evidence, following OpenAI's prompting guidance.

Separate the notebook from its working files

Google's Colab FAQ, checked October 24, 2026, explains that managed code runs in a private virtual machine with a limited lifetime. Sharing a notebook also does not share that machine's custom files or installed libraries. A visible saved output therefore cannot establish that a new runtime has everything needed to reproduce it.

Consider an authored inventory exercise with three rows in stock.csv:

item,units
labels,12
folders,7
clips,9

The calculation expects 28 units:

from pathlib import Path
import csv

source = Path('/content/stock.csv')
print('Working directory:', Path.cwd())
print('Input exists:', source.is_file())
if not source.is_file():
    raise FileNotFoundError(f'Restore the approved input first: {source}')

with source.open(newline='', encoding='utf-8') as handle:
    rows = list(csv.DictReader(handle))
total = sum(int(row['units']) for row in rows)
print('Total units:', total)
assert total == 28

Here /content/stock.csv is an explicit runtime path. It is not a promise that a file with that name exists in your account. If you uploaded this file into a previous runtime, restore it to the intended location using Colab's file interface. Confirm its actual name; a duplicate download named stock (1).csv will not satisfy the path above.

Give ChatGPT the storage evidence

Start with a read-only inspection cell:

from pathlib import Path
folder = Path('/content')
print('Folder exists:', folder.is_dir())
if folder.is_dir():
    print([p.name for p in folder.iterdir() if p.is_file()])

Review that listing before sharing it. Send only permitted filenames and the relevant error, rather than an entire private directory inventory.

Help diagnose this Google Colab input-file failure.
I am manually copying evidence; you are not connected to my runtime.
Runtime type: [MANAGED COLAB OR DESCRIBE OTHER SETUP]
Cell and complete error: [PASTE]
Expected input filename and approved origin: [ENTER]
Current working directory and relevant file listing: [PASTE]
How I supplied the input previously: [UPLOAD / DRIVE / OTHER]
What happened before the failure: [ENTER]

Separate a missing runtime file from a wrong path, wrong filename,
or a calculation error. Propose read-only checks first. Do not invent
files, connect accounts, change sharing, or replace missing data with
sample rows. Explain how I can restore the approved input and verify
its row count before rerunning. Distinguish expected from observed output.

For this fixture, a listing without stock.csv supports restoring that file. It does not support changing sum or hard-coding 28. If the file exists but a column is missing, inspect its header next; that is a different failure.

Preserve the input and output deliberately

Before ending a session, download a needed generated file or save it in your approved persistent storage. Verify that saved copy by opening it from its destination. Keep the input's identity, required packages and setup steps in the notebook so a later runtime can reconstruct the work. Do not include a private dataset in a shared notebook simply to remove a path error.

For an out-of-order variable failure, use the Jupyter fresh-kernel workflow. If you want ChatGPT to read an existing Drive document, the Google Drive connection guide covers that separate authorization task; connecting Drive to ChatGPT does not restore a Colab runtime file.

Finish by running the notebook against the restored input and inspecting the new result. For the three-row exercise, retain the actual Total units: 28 output with the saved notebook and a retrievable copy of the CSV.

Keep reading