Introduction
In this post I walk through how a data analysis beginner can set up an analysis environment with Google Drive and Google Colaboratory.
There are four steps: create an analysis folder in Drive, create a Colab notebook inside it, put your CSV in the same folder, then connect Drive with drive.mount() and read the file with pandas. Keeping the data and the notebook in one folder means anyone you share the folder with can reproduce the same analysis.
Updated December 2026: fixed a code error (the original used pd after a plain import pandas), and added that the mounted path is /content/drive/MyDrive/, why encoding="cp932" is recommended for Japanese CSV files, the "Mount Drive" button in the Files panel, and caveats about mounting.
Working in Google Drive
First, create a folder for your analysis in Google Drive.
Open Google Drive, click "New" and then "New folder" to create a folder. In this example the folder is called "ProjectA" (the screenshots show the Japanese name プロジェクトA).

If you want to work on the project with people outside your account, share the folder with them so you can develop together.

If the people you share with should only be able to view the code, set their access to "Viewer", click "Copy link" and send them the URL.
Create a notebook in the folder
Next, create a notebook for the analysis inside the ProjectA folder.
With the ProjectA folder open, click "New", then "More", then "Google Colaboratory" to create a new notebook.
If "Google Colaboratory" is not listed under "More", add it via "More" → "Connect more apps". Alternatively, create a notebook in Colab with "File" → "New notebook in Drive" and then move it into the ProjectA folder in Drive (notebooks created from Colab are saved to the "Colab Notebooks" folder in My Drive by default).
A new notebook is named something like "Untitled0.ipynb", so click the file name at the top left and rename it.
Prepare a CSV to analyze
Next, prepare a CSV as test data.
Here I use a CSV published on e-Stat, the Japanese government's official statistics portal (an English version is available).
Follow the link below and download a CSV from any statistical dataset you like. Any CSV file works if you prefer a dataset from your own country.

Drag and drop the downloaded CSV into the project folder you created so it is saved there.
Mount Google Drive from Colab
Next, make the uploaded CSV readable from the notebook.
Paste the following code into a code cell in the notebook and run it.
from google.colab import drive
drive.mount('/content/drive')
Colab asks whether to permit the notebook to access your Google Drive files. Click "Connect to Google Drive".
When asked which account to use, choose the account whose Google Drive you want to use and allow access on the permissions screen. If the cell output shows Mounted at /content/drive, it worked.
After that, click the folder button on the left side of the notebook and refresh: you can now reach your Google Drive through the MyDrive folder under drive. The ProjectA folder in this example is /content/drive/MyDrive/ProjectA/.
Instead of writing code, you can also click the "Mount Drive" button at the top of the Files panel (opened with the folder button on the left). According to the official Colab FAQ, in a notebook that only you have edited, Drive may be remounted automatically after you have authorized it once. In notebooks that others have edited, it is not mounted automatically, so you run the code above each time.
The mount is lost when the runtime is disconnected or deleted. When you reopen the notebook the next day, run the drive.mount() cell again first. The official FAQ also notes that mounting may time out if the top level of My Drive contains roughly 10,000 or more files.
Read the CSV with pandas
Now let's set up the environment to analyze the CSV downloaded from e-Stat.
First create a new code cell and paste in the following code.
import pandas as pd
df = pd.read_csv("paste the CSV path here")
print(df)
Click the "+ Code" button to create a new code cell.
Next, get the path of the CSV you placed in Google Drive.
In the Files panel, open drive → MyDrive → ProjectA, then choose "Copy path" from the "⋮" (more actions) menu next to the CSV file. A path like /content/drive/MyDrive/ProjectA/filename.csv is copied.
Pass the copied path to pd.read_csv as a string and run the cell. If the CSV contents are printed, you're done.
If you get an encoding error
CSVs from Japanese government sources such as e-Stat, and CSVs saved from Japanese Excel, are often in a Shift_JIS-family encoding. Reading them as-is raises an error like UnicodeDecodeError: 'utf-8' codec can't decode byte …. In that case, specify encoding:
df = pd.read_csv("/content/drive/MyDrive/ProjectA/filename.csv", encoding="cp932")
df.head()
The first version of this article used encoding="shift-jis", but "cp932" is the better choice. cp932 is the Windows extension of Shift_JIS and can also read vendor-specific characters such as 髙 and ①, which can cause errors with shift_jis. For other methods such as reading Excel files or loading from a URL, see how to upload and read files in Google Colab.
Save your results to Drive as well
Files you create on the Colab runtime (directly under /content) are deleted when the runtime is deleted. Save processed data and charts to the ProjectA folder so the people you share it with can see them too.
df.to_csv("/content/drive/MyDrive/ProjectA/result.csv", index=False, encoding="utf-8-sig")
Saving with encoding="utf-8-sig" (UTF-8 with BOM) keeps the text readable when the file is opened in Excel.
Summary
This post showed how to set up an analysis environment with Google Drive and Google Colab.
If you want someone to review your code, sharing only the notebook isn't enough: without the CSV and other data they can't reproduce your results. I hope this setup helps.
Note that sharing a notebook shares its text, code, output and comments, but not the execution environment (the virtual machine) or the files on it (per the official FAQ). That is why the data belongs in the Drive folder. For free-tier runtime and GPU limits, see Google Colab pricing and free tier limits.
I also recommend a Colab setting in the article below:


