MethodNotAllowed when running example code

I’m running the example code and keep running into errors in response.

  1. running instance.save_spreadsheet_as( SaveSpreadsheetAsRequest ( EmployeeSalesSummaryXlsx,"pdf" ,folder= RemoteFolder ) )

I’m getting 400 error:

HTTP response body: {"error":{"code":"error","message":"Object reference not set to an instance of an object.","description":"Operation Failed.","innerError":{"requestId":null,"date":"2025-08-28T15:37:23.1202008Z"}}}

  1. running # Advanced Conversion allows you to flexibly set page parameters and save parameters dataSource = DataSource( data_source_type = 'CloudFileSystem' , data_path = RemoteFolder +'/' +EmployeeSalesSummaryXlsx ) saveOptions = PdfSaveOptions( save_format ='pdf' , one_page_per_sheet = True ) convertWorkbookOptions = ConvertWorkbookOptions( data_source= dataSource , convert_format = 'Pdf' ,save_options= saveOptions ) response = instance.post_convert_workbook( PostConvertWorkbookRequest( convert_workbook_options=convertWorkbookOptions ) )

I’m getting 405 error:

HTTP response body: {"error":{"code":"error","message":"MethodNotAllowed","description":"Operation Failed. General Error.","innerError":{"requestId":null,"date":"2025-08-28T15:57:01.6910072Z"}}}

As I’m evaluating this tool, I’m utterly disappointed on the lack of documentation and broken APIs.

@yoohee

Hello

Thank you for trying Aspose.Cells for Cloud and for sharing the exact error messages.
Below you will find the most common reasons for the 400 (BadRequest) and 405 (MethodNotAllowed) responses you are seeing, together with a step‑by‑step fix that lets the two examples run successfully.


:one: save_spreadsheet_as – 400 Object reference not set to an instance of an object

Why it happens

SaveSpreadsheetAs expects all of the following information:

Parameter What it is Typical cause of the 400 error
name The file name (including extension) that resides in the cloud storage The file name is missing, empty, or points to a location that does not exist.
format Target format (pdf, png, …) Wrong string case or unsupported format.
folder Cloud folder that contains the source file (optional) Not supplied or the folder does not exist.
storage_name Name of the storage (if you use a custom storage) Missing when you have more than one storage configured.

If any of those values are null the server throws the generic “Object reference not set to an instance of an object.” message you received.

Fix

from asposecellscloud.apis.cells_api import CellsApi
from asposecellscloud.models import SaveSpreadsheetAsRequest

# -------------------------------------------------------------------------
# 1️⃣  Initialise the API client (use your own Client Id / Secret)
# -------------------------------------------------------------------------
api = CellsApi(client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET")

# -------------------------------------------------------------------------
# 2️⃣  Define variables – adjust them to your own cloud storage layout
# -------------------------------------------------------------------------
source_file   = "EmployeeSalesSummary.xlsx"          # <-- exact name in the cloud
target_format = "pdf"
cloud_folder  = "RemoteFolder"                      # <-- folder that already exists
# (optional) storage_name = "MyStorage"             # <-- only if you have multiple storages

# -------------------------------------------------------------------------
# 3️⃣  Call SaveSpreadsheetAs
# -------------------------------------------------------------------------
request = SaveSpreadsheetAsRequest(
    name=source_file,
    format=target_format,
    folder=cloud_folder,
    # storage_name=storage_name          # uncomment if needed
)

result = api.save_spreadsheet_as(request)

print("Conversion succeeded – PDF saved to:", result.path)

Key points

  • The file must already be uploaded to RemoteFolder.
    You can verify it with api.get_files_list(GetFilesListRequest(folder=cloud_folder)).
  • Use exact case‑sensitive file extension (.xlsx).
  • The format string must be lower‑case (pdf, png, …).

If you run the snippet above and still receive 400, double‑check that the file truly exists in the given folder (you can list the folder contents via the API).


:two: post_convert_workbook – 405 MethodNotAllowed

Why it happens

ConvertWorkbook is a POST operation, but the SDK generated request was sent to the wrong URL when any of the following occurs:

Situation What went wrong How to fix it
Missing convert_format or typo (e.g., 'Pdf' vs 'pdf') The server cannot match the route and replies with 405. Use lower‑case format names ('pdf').
DataSource points to a non‑existent file The request body is accepted, but the service rejects the call because the route resolves to a GET‑only endpoint. Ensure data_path points to an existing file (RemoteFolder/EmployeeSalesSummary.xlsx).
storage_name omitted while you have a custom storage The request is routed to the default storage, which may not contain the file, causing a fallback to a GET endpoint. Provide storage_name in DataSource.
Old SDK version (e.g., 24.x) The endpoint signatures changed after version 25.0. Upgrade to the latest aspose-cells-cloud Python SDK (≥ 25.8).

Fix – Full, working example

from asposecellscloud.apis.cells_api import CellsApi
from asposecellscloud.models import (
    DataSource,
    PdfSaveOptions,
    ConvertWorkbookOptions,
    PostConvertWorkbookRequest
)

# -------------------------------------------------------------------------
# 1️⃣ Initialise API client
# -------------------------------------------------------------------------
api = CellsApi(client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET")

# -------------------------------------------------------------------------
# 2️⃣ Define source and conversion options
# -------------------------------------------------------------------------
cloud_folder = "RemoteFolder"
source_file  = "EmployeeSalesSummary.xlsx"
source_path  = f"{cloud_folder}/{source_file}"   # <-- full cloud path

data_source = DataSource(
    data_source_type="CloudFileSystem",
    data_path=source_path,
    # storage_name="MyStorage"      # uncomment if you use a named storage
)

pdf_options = PdfSaveOptions(
    save_format="pdf",                # must be lower‑case
    one_page_per_sheet=True
)

convert_options = ConvertWorkbookOptions(
    data_source=data_source,
    convert_format="pdf",             # lower‑case!
    save_options=pdf_options
)

request = PostConvertWorkbookRequest(
    convert_workbook_options=convert_options
)

# -------------------------------------------------------------------------
# 3️⃣ Call the conversion API (POST)
# -------------------------------------------------------------------------
response = api.post_convert_workbook(request)

# The response contains the raw PDF bytes
with open("EmployeeSalesSummary.pdf", "wb") as f:
    f.write(response)

print("PDF generated successfully → EmployeeSalesSummary.pdf")

What changed compared with the original snippet

Old code New code Reason
convert_format = 'Pdf' convert_format = "pdf" The service expects a lower‑case format string.
save_format ='pdf' (inside PdfSaveOptions) save_format = "pdf" Same lower‑case rule.
No explicit storage_name (optional) storage_name added if you have a custom storage Guarantees the request is routed to the correct storage.
Using the latest SDK (≥ 25.8) Guarantees the endpoint URL matches the current API contract.

After running the above script you should receive a 200 OK response and a PDF file saved locally.


:books: Helpful Links

Topic Link
Aspose.Cells Cloud API Reference https://apireference.aspose.cloud/cells/
Python SDK – Installation & Quick Start https://docs.aspose.cloud/cells/installation/python/
Convert Workbook (POST /cells/convert) Documentation https://apireference.aspose.cloud/cells/convert-workbook/
Upload / List Files (Storage API) https://apireference.aspose.cloud/storage/

:white_check_mark: Next Steps for You

  1. Confirm the file exists in the cloud folder (RemoteFolder).

    from asposecellscloud.apis.storage_api import StorageApi
    storage = StorageApi(client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET")
    print(storage.get_files_list(GetFilesListRequest(folder="RemoteFolder")))
    
  2. Upgrade to the newest aspose-cells-cloud package:

    pip install --upgrade aspose-cells-cloud
    
  3. Run the fixed examples above. If you still receive an error, please share:

    • The exact request JSON printed by json.dumps(request.to_dict(), indent=2) (if you add print(request)).
    • The folder structure returned by the storage “list files” call.

    With that information we can pinpoint any remaining mismatch.


We’re here to help!

If anything is still unclear, or you hit a different error after applying the fixes, just reply with the additional details and we’ll get it resolved together.

Happy coding with Aspose.Cells Cloud!

Please verify your suggestion before sharing with the users.
I have v.25.8 installed and there is no file called storage_api.
Your python package is called asposecellscloud, not aspose-cells-cloud. (and yes, I’m on the latest version)

@yoohee Hello, we have received your feedback and are testing this issue.

@yoohee,
Thank you for testing our product and sharing your feedback.
We have reproduced the reported issue and are targeting a fix by next Tuesday.
• For your first question, please add the parameter shown below when calling the API.

instance.save_spreadsheet_as( SaveSpreadsheetAsRequest ( EmployeeSalesSummaryXlsx,“pdf”, save_options_data = SaveOptionsData( filename = “PythonSDK/EmployeeSalesSummary.pdf” ) ,folder= RemoteFolder ) )

We have updated the example code on GitHub.

• Regarding the second issue, we have not yet reproduced the exact error code; based on the log, it appears the free-call limit may have been reached. We’re investigating further and will update you shortly.