@@ -6333,10 +6333,10 @@ To access files stored in your Google Drive:
63336333
63346334 from google.colab import drive
63356335 import pandas as pd
6336-
6336+
63376337 # Mount your Google Drive
63386338 drive.mount(' /content/drive' )
6339-
6339+
63406340 # Read file from Drive
63416341 df = pd.read_csv(' /content/drive/MyDrive/your_file.csv' )
63426342
@@ -6350,10 +6350,10 @@ To upload files from your local machine:
63506350 from google.colab import files
63516351 import pandas as pd
63526352 import io
6353-
6353+
63546354 # Upload file (opens file picker dialog)
63556355 uploaded = files.upload()
6356-
6356+
63576357 # Read the uploaded file
63586358 for filename in uploaded.keys():
63596359 df = pd.read_csv(io.BytesIO(uploaded[filename]))
@@ -6366,7 +6366,7 @@ Direct URL loading works the same as in standard pandas:
63666366.. code-block :: python
63676367
63686368 import pandas as pd
6369-
6369+
63706370 # Read from any public URL
63716371 url = ' https://raw.githubusercontent.com/example/repo/main/data.csv'
63726372 df = pd.read_csv(url)
@@ -6379,23 +6379,23 @@ To read data from Google Sheets:
63796379.. code-block :: python
63806380
63816381 import pandas as pd
6382-
6382+
63836383 # Option 1: Export as CSV (sheet must be publicly accessible)
63846384 sheet_id = ' your-spreadsheet-id'
63856385 sheet_name = ' Sheet1'
63866386 url = f ' https://docs.google.com/spreadsheets/d/ { sheet_id} /gviz/tq?tqx=out:csv&sheet= { sheet_name} '
63876387 df = pd.read_csv(url)
6388-
6388+
63896389 # Option 2: Using authentication for private sheets
63906390 # Note: Requires gspread library (pip install gspread)
63916391 from google.colab import auth
63926392 import gspread
63936393 from google.auth import default
6394-
6394+
63956395 auth.authenticate_user()
63966396 creds, _ = default()
63976397 gc = gspread.authorize(creds)
6398-
6398+
63996399 worksheet = gc.open(' Your Spreadsheet Name' ).sheet1
64006400 data = worksheet.get_all_values()
64016401 df = pd.DataFrame(data[1 :], columns = data[0 ])
0 commit comments