What file path do I give Excel, Python or an AI agent?
Pick a path a program can open, fix a coworker's script, and see why an online-only file can fail without internet.
Free course. Your Maestro, an AI, .
Excel, a Python script and an AI agent have one thing in common: to open a file, they need its path. When you double-click, the computer fills it in for you. When a program is the one opening the file, you supply the path. With what you know now, you can pick it well.
Three questions before you give a program a path
- Is the file on your disk? If it lives in a synced folder and it's online-only, it won't open without internet. If the program will run offline, mark the file Always keep on this device first (in Google Drive, make sure it's mirrored or that you've already opened it).
- Where is the path counted from? An absolute path, the one you copy from File Explorer or Finder, doesn't depend on anything. A relative one only works if you know which folder the program will count from.
- Is it your path or someone else's? A path that goes through another person's user folder doesn't exist on your computer. If someone hands you a script, change the path to yours.
A practical detail: OneDrive and SharePoint paths often have spaces in them. When you type a path with spaces in a terminal or in code, put it in quotes, so the program reads it as one thing and not as several words.
What if the program opens an online-only file?
You already know an online-only file won't open without internet. With internet, Microsoft explains that opening an online-only file downloads it and makes it available on your device. When a program opens it instead of you, here's what Microsoft documents:
Microsoft explains that when you use OneDrive to store online-only files, some Windows apps might download them automatically. Its example is a music app that downloads songs to play them.
When that happens, Windows shows you a notification that says where the files are downloading from, how many there are and how the download is going. You can let it finish, or choose Cancel download. With Cancel download and then Block app, that app can't download online-only files anymore. Microsoft warns that blocking apps could make them unstable: if it's a program you trust that opens your files often, don't block it.
Microsoft's Mac help says that when you open an online-only file, it downloads to the device and becomes available locally, but it doesn't describe what happens when another program opens it on its own.
So on a Mac, don't assume: if one of your programs is going to read a OneDrive file, mark it Always keep on this device first. That's the safe way on both systems.
An end-to-end example
Ana sends you a script that adds up April sales for the three branches. Inside, it says C:\Users\ana\Documents\ventas_abril.csv (on a Mac it would be something like /Users/ana/Documents/ventas_abril.csv). Before you run it, go through the three questions:
- Is it your path? No: it goes through Ana's user folder, which describes her computer, not yours. Even if you have the same file, that path most likely doesn't exist on your machine.
- Where's your copy, and is it on your disk? Find it in File Explorer or Finder and check its icon. If it has the cloud and you'll be working offline, mark it Always keep on this device.
- Which path do you type? Copy your file's absolute path, as in module 1, and put it in the script in place of Ana's. If it has spaces, keep it in quotes.
If the script still can't find the file, ask your Maestro what to check.
Your turn
Below is Ana's script, ventas_del_mes.py, next to the Ventas folder from the team's library, which you've already brought to your computer. This time there are no steps: use what you practiced in module 1. Find the April 2026 file with pwd, ls, cd and cat, replace Ana's path with the path of the file in this project, and run python ventas_del_mes.py from the project folder.
On your own computer you'd paste the absolute path you copy from File Explorer or Finder. Here the project lives in the course's environment, so type the path counted from the project folder, as in module 1. The sales figures are made up.
Before you change anything, run it once exactly as Ana sent it. Your terminal should answer:
Nothing found at: C:\Users\ana\Documents\ventas_abril.csvIs that path on this computer? Look for it with ls and cd.That's exactly what would happen on your laptop: the path describes Ana's computer. Heads up: there's more than one ventas_abril.csv in the Ventas folder.
Your turn
Change Ana's path in ventas_del_mes.py to the path of the April 2026 sales file in this project, counted from the project folder, and run python ventas_del_mes.py. You've got it when it says it found ventas_abril.csv in Ventas/2026 with 4 April sales.
- Ventas
- 2025
- 2026
Enter runs · ↑ ↓ history · → accepts · helpCtrl+Enter runs · Tab indents · Esc then Tab leaves · Ctrl+` terminal
And an AI agent?
An AI agent on your computer works with the files in the folder you open it in, so the question shifts a little: it's not only which path you give it, but which folder you open it in and whether the files it needs are there, on your disk. How an agent reaches your data and which permissions to give it is covered step by step in the Agentic AI for Data course.
And if you're going to write your own programs, how Python decides where to start counting a relative path is covered in Python for Data People.
Check yourself: Tomorrow you're traveling with no internet, and your Python script has to read ventas.csv, which is in your OneDrive folder with a blue cloud next to its name. What do you do today?
Think of a file you use every week at work. Where does it really live: on your disk, only in the cloud, in one of your team's libraries? What would you do differently now to send it, find it or give it to a program?
Reflect: Think of a file you use every week at work. Where does it really live: on your disk, only in the cloud, in one of your team's libraries? What would you do differently now to send it, find it or give it to a program?
Only you and your Maestro read this. It's kept on your account and deleted with it.