KeyError: 'aspose.cells'

File “tristar.py”, line 13, in
from aspose.cells import License,Workbook,FileFormatType
File “”, line 991, in _find_and_load
File “”, line 975, in _find_and_load_unlocked
File “”, line 655, in _load_unlocked
File “”, line 626, in _load_backward_compatible
KeyError: ‘aspose.cells’

My development environment:

aspose-cells==21.12.0
aspose-pdf==23.7.0
aspose-words==23.4.0
Python Version: 3.8.10
Operating System: Ubuntu 20.04.6 LTS

@jaypatel529,

We recommend you to kindly try using our latest version/fix,
Aspose.Cells for Python via .NET 23.9.

If you still find the issue, kindly do share your complete sample (runnable) code and template Excel file (if any) to reproduce the issue on our end, we will check it soon.

I have already tried the latest version of Aspose Cell but am facing the same issue.

here is my complete code

import os, json, re, uuid
import aspose.words as aw
import aspose.pydrawing as drawing
import aspose.pdf as pdf
import aspose.cells as cells
from aspose.cells import License,Workbook,FileFormatType   


main_folder_path =  "reports"
gcp_path = "2153"
folder_path = f"{main_folder_path}/{gcp_path}"

for sub_folders in os.listdir(folder_path):
    sub_folder_path = f"{folder_path}/{sub_folders}"
    if os.path.isdir(f"{folder_path}/{sub_folders}"):
        for file in os.listdir(sub_folder_path):
            aw.License.set_license('Aspose.Total.Product.Family.lic')
            cells.set_license('Aspose.Total.Product.Family.lic')
            if file.endswith(".docx") or file.endswith(".doc") :
                print(file)
                file_path = f"{sub_folder_path}/{file}"
                doc = aw.Document(file_path)
                pdf_file_path = file_path.replace(".docx", ".pdf").replace(".doc", ".pdf")
                if not os.path.exists(pdf_file_path):
                    doc.save(pdf_file_path, aw.SaveFormat.PDF)
            elif file.endswith(".tiff"):
                print(file)
                doc = aw.Document()
                builder = aw.DocumentBuilder(doc)
                file_path = f"{sub_folder_path}/{file}"
                pdf_file_path = file_path.replace(".tiff", ".pdf")
                try:
                    builder.insert_image(file_path)
                    if not os.path.exists(pdf_file_path):
                        doc.save(pdf_file_path)
                except:
                    pass
            if file.endswith(".xlsx"):
                print(file)
                file_path = f"{sub_folder_path}/{file}"
                pdf_file_path = file_path.replace(".xlsx", ".pdf")
                if not os.path.exists(pdf_file_path):
                    workbook = Workbook(file_path)
                    workbook.save(pdf_file_path)

@jaypatel529
We have two products related to Python: Aspose.Cells for Python via .NET (aspose-cells-python) and Aspose.Cells for Python via JAVA (aspose-cells).

If you want to use Aspose.Cells for Python via .NET, please run the following command.

pip install aspose-cells-python

Hope helps a bit.

@jaypatel529,

It seems you have installed Aspose.Cells for Python via Java instead of Aspose.Cells for Python via .NET, here is the download page:

Thank you for your response, and now the problem is resolved by installing Aspose Cells via .net instead of via java .

@jaypatel529,

It’s great to hear that your issue has been resolved by installing the correct version (Aspose.Cells for Python via .NET). Please feel free to reach out to us if you have any further queries or comments. We’ll be happy to assist you soon.