0Pricing
Data Science Academy · درس

فتح أوراق Excel في pandas

قراءة أوراق ونطاقات محددة

فتح أوراق Excel في pandas درس مجاني في Data Science Academy على CoddyKit. هذا هو الدرس 2 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في Data Science Academy، وتقدمك يتزامن عبر الويب وتطبيق CoddyKit. تتضمن دورة Data Science Academy 4 دروس في المجموع.

بعض أجزاء هذا الدرس لم تُترجم بعد وتظهر باللغة الإنجليزية.

Excel Everywhere

Most teams still share data as spreadsheets. Good news: pandas opens them almost as easily as CSVs, so you rarely need Excel itself. 📊

The read_excel Call

To load a workbook, reach for read_excel. Give it the file path and pandas hands you a DataFrame just like before.

import pandas as pd
df = pd.read_excel("report.xlsx")

One Hidden Requirement

Behind the scenes pandas needs the openpyxl library to read xlsx files. Install it once and read_excel just works.

pip install openpyxl

Workbooks Have Many Sheets

A single workbook can hold several tabs. By default pandas reads only the first sheet, which is not always the one you want.

Choose a Sheet by Name

Pass sheet_name with the tab title to grab exactly the right one. Names are clearer and safer than relying on position.

df = pd.read_excel("report.xlsx",
  sheet_name="Q3")

Or Pick by Position

You can also select a sheet by its zero-based index. sheet_name=1 reads the second tab in the workbook.

df = pd.read_excel("report.xlsx", sheet_name=1)

Load Every Sheet at Once

Set sheet_name=None and pandas returns a dictionary mapping each tab name to its own DataFrame. Handy for whole workbooks.

all_sheets = pd.read_excel("report.xlsx",
  sheet_name=None)

Skip the Junk on Top

Excel files often start with a title or blank rows. Use skiprows to ignore them so the real header lands correctly.

df = pd.read_excel("report.xlsx", skiprows=3)

Read Just a Column Range

The usecols option accepts Excel letters like A:D, pulling only those columns straight from the sheet.

df = pd.read_excel("report.xlsx",
  usecols="A:D")

Set the Index on Load

Just like with CSVs, index_col promotes a column to the row index right as the spreadsheet is read.

df = pd.read_excel("report.xlsx",
  index_col="id")

Same Skills, New Source

Notice the pattern: read_excel shares most options with read_csv. Learn one reader and the others feel instantly familiar.

Quick Check

You want every tab in a workbook loaded at once. What do you set?

Recap: Excel Unlocked

You can open any workbook with read_excel: choose sheets by name or index, skip junk rows, and limit columns. Spreadsheets hold no secrets now. 🎉

الأسئلة الشائعة

هل درس «فتح أوراق Excel في pandas» مجاني؟

نعم — نص درس «فتح أوراق Excel في pandas» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة Data Science Academy، انتقل إلى CoddyKit PRO. تتضمن دورة Data Science Academy 4 دروس في المجموع.

ماذا ستتعلم في «فتح أوراق Excel في pandas»؟

قراءة أوراق ونطاقات محددة تتمرن على Data Science Academy مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.

هل أحتاج إلى خبرة سابقة لأبدأ Data Science Academy؟

لا تُشترط خبرة سابقة. Data Science Academy على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 2 من أصل 4.

كم من الوقت يستغرق درس «فتح أوراق Excel في pandas»؟

معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.

هل يمكنني كتابة وتشغيل أكواد في درس Data Science Academy هذا؟

نعم. كل درس في Data Science Academy يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.

جميع الدروس في هذه الدورة

  1. read_csv وخياراته المفيدة
  2. فتح أوراق Excel في pandas
  3. تحليل التواريخ وتعيين dtypes عند التحميل
  4. حفظ النتائج إلى CSV وExcel
← العودة إلى Data Science Academy