Convert Excel to Python Data

How to Convert Excel Workbook to Dictionary

Here’s an example code snippet to demonstrate how to export Excel data to a dictionary using Aspose.Cells for Python via .NET:

  1. Load the sample file.
  2. Traverse all worksheets and convert the workbook to a dictionary using Aspose.Cells for Python via .NET library.

The output result:

{'Sheet1': [['City', 'Region', 'Store'], ['Chicago', 'Central', 3055], ['New York', 'East', 3036], ['Detroit', 'Central', 3074]],
 'Sheet2': [['City2', 'Region2', 'Store3'], ['Seattle', 'West', 3000], ['Philadelphia', 'East', 3082], ['Detroit', 'Central', 3074]],
 'Sheet3': [['City3', 'Region3', 'Store3'], ['Seattle', 'West', 3166], ['New York', 'East', 3090], ['Chicago', 'Central', 3055]]}

How to Convert Excel Workbook to List

Here’s an example code snippet to demonstrate how to export Excel data to a list using Aspose.Cells for Python via .NET:

  1. Load the sample file.
  2. Traverse all worksheets and convert the workbook to a list using Aspose.Cells for Python via .NET library.

The output result:

[[['City', 'Region', 'Store'], ['Chicago', 'Central', 3055], ['New York', 'East', 3036], ['Detroit', 'Central', 3074]],
 [['City2', 'Region2', 'Store3'], ['Seattle', 'West', 3000], ['Philadelphia', 'East', 3082], ['Detroit', 'Central', 3074]],
 [['City3', 'Region3', 'Store3'], ['Seattle', 'West', 3166], ['New York', 'East', 3090], ['Chicago', 'Central', 3055]]]

How to Convert Worksheet to List

Here’s an example code snippet to demonstrate how to export worksheet data to a list using Aspose.Cells for Python via .NET:

  1. Load the sample file.
  2. Get the first worksheet.
  3. Convert worksheet data to a list using Aspose.Cells for Python via .NET library.

The output result:

[['City', 'Region', 'Store'], ['Chicago', 'Central', 3055], ['New York', 'East', 3036], ['Detroit', 'Central', 3074]]

How to Convert a ListObject of Excel to List

Here’s an example code snippet to demonstrate how to export ListObject data to a list using Aspose.Cells for Python via .NET:

  1. Load the sample file.
  2. Get the first worksheet.
  3. Create a ListObject.
  4. Convert ListObject data to a list using Aspose.Cells for Python via .NET library.

The output result:

[['City', 'Region', 'Store'], ['Chicago', 'Central', 3055], ['New York', 'East', 3036], ['Detroit', 'Central', 3074]]

How to Convert a Row of Excel to List

Here’s an example code snippet to demonstrate how to export Row data to a list using Aspose.Cells for Python via .NET:

  1. Load the sample file.
  2. Get the first worksheet.
  3. Get the Row object by row index.
  4. Convert Row data to a list using Aspose.Cells for Python via .NET library.

The output result:

['Detroit', 'Central', 3074]

How to Convert a Column of Excel to List

Here’s an example code snippet to demonstrate how to export Column data to a list using Aspose.Cells for Python via .NET:

  1. Load the sample file.
  2. Get the first worksheet.
  3. Get the Column object by column index.
  4. Convert Column data to a list using Aspose.Cells for Python via .NET library.

The output result:

['Store', 3055, 3036, 3074]

How to Convert a Range of Excel to List

Here’s an example code snippet to demonstrate how to export range data to a list using Aspose.Cells for Python via .NET:

  1. Load the sample file.
  2. Get the first worksheet.
  3. Create the Range.
  4. Convert Range data to a list using Aspose.Cells for Python via .NET library.

The output result:

[['Region', 'Store'], ['Central', 3055], ['East', 3036]]