How to determine a range of cells in Python via dot net aspose.cells

We are trying to insert into a range of cells from a python dataframe. can you point us to range function available for python via dotnet? Also is it even possible to load a python dataframe value into the cell using this lib?

@psethu01,

Range class is supported and Cells.createRange() is used to create a range of cells in the worksheet.

@Amjad_Sahi
I get the following error,

‘aspose.cells.Cells’ object has no attribute ‘createRange’
AttributeError: ‘aspose.cells.Cells’ object has no attribute ‘createRange’
    cellx = worksheet.cells.createRange("D11", "D15")

    print(cellx)

    cellx.put_value(df5, True, True)

Tried this as well,
cellx = worksheet.cells
range = cellx.CreateRange(“D11: D13”)
range.put_value(df5, True, True)

@psethu01
For Python.Net version,the method is usually including a “_”.
e.g
cellx = worksheet.cells
range = cellx.create_range(“D11: D13”)
range.put_value(df5, True, True)

Now, you can get the method or variable prompt in the tool ipython by ". " and "tab” key.
We apologize for any inconvenience caused.

@xinyazhu it works now. Thanks for the update.

@psethu01,

Good to know that the suggested code segment fixes your issue.

Wanted to check if the Python via dot net aspose.cells supports load from a pandas dataframe(series object) onto the excel file cells using the put_value method.
We got the following error when we tried,

can’t build String from ‘Series’

Basically its complaining that it cannot load from a data frame object.
@Amjad_Sahi @xinyazhu

@psethu01,

It may not be possible to directly load/import pandas dataframe into Excel spreadsheet via Aspose.Cells for Python via .NET. I think you first need to get values/string from pandas dataframe (Series) by yourselves in code and then use Cell.put_value() in Aspose.Cells for Python via .NET APIs to insert into Excel worksheet.

@Amjad_Sahi
converting the dataframe to a string places the entire contents for the df into a single cell/row rather than multiple rows as expected.
ex:
df1:
a1
a2
a3
a4

cell3 = cellx.create_range(“D11:D14”)
cell3.put_value(df1)
This places the values a1 to a4 in all the 4 cells instead of 1 in each.
Attaching the output file here.rpt_monthly_win32_old.zip (1.6 MB)

@psethu01,

As I told you that you may use Cell۔put_value() to insert each string value in different cells separately by yourselves.

@Amjad_Sahi yes, i did the same, but wanted to check if there was an loader option other than iterating 1 cell at a time.
Finally, wanted to confirm if Python via dot net aspose.cells is platform independent and runs on linux machines.

There is no specific option available for it in Aspose.Cells for Python via .NET API.

Aspose.Cells for Python via .NET is platform-independent API and can be used on any platform (Windows and Linux, etc.) where Python is installed. See the System Requirements page for your reference.