Can't load in XLS file in Aspose Cells Python via .net

I’m trying to load up an XLS file into a workbook, but every time I get an error.

When I try to load it via stream I get this error:

RuntimeError: Proxy error(CultureNotFoundException): Culture is not supported. (Parameter ‘culture’)
1033 (0x0409) is an invalid culture identifier.

I have tried running with no load options, running with ac.LoadOptions(ac.LoadFormat.EXCEL_97_TO_2003), and a number of other combinations, but I cannot get it to load.

@acn,

Could you please zip and attach the XLS file that you are trying to load and getting the error? We will check your issue soon.

Book1.xls.zip (6.9 KB)

Yes, thank you. Here it is. I have tried with file path and with stream.

2 posts were split to a new topic: Could not load DOC file in Aspose.Words Python via .net

I tried to use latest version Aspose.Cells for Python via .NET v24.1 with your XLS file and it works fine. Here is my sample code. Aspose.Cells does load and re-save the file fine. Please find attached the output XLS file for your reference.
e.g.
Sample code:

import aspose.cells
from aspose.cells import Workbook, CellsHelper, License

print(CellsHelper.get_version())

workbook = Workbook("c:\\Downloads1\\aspose.cells.python.net\\" + "Book1.xls")
workbook.save("c:\\Downloads1\\aspose.cells.python.net\\" + "output1.xls")

output1.zip (5.6 KB)

Screenshot 2024-02-02 at 3.06.54 PM.png (97.9 KB)

I ran your exact code segment and continue to get the error. Do you know where this could be coming from?

@acn
Thanks for further details. Let us investigate and analyze your issue in details. We will get back to you soon.

@acn
Because you encountered a similar error when running Aspose.Words for Python via .NET, we believe it might be a configuration issue. According to the error message, “1033 (0x0409)” is the culture identifier for American English.

What is your operating system? Could you please check the regional and language settings on your computer? Please run the following code to detect the locale value.

import locale
current_locale = locale.getdefaultlocale()
print(current_locale)

On our computer, the “Regional Format” setting is "English (United States) ".
Additionally, you can try using the following code to set the desired culture:

import locale
desired_culture = 'en_US'  
locale.setlocale(locale.LC_ALL, desired_culture)

Hope helps a bit!

Screenshot 2024-02-06 at 9.59.29 AM.png (60.8 KB)

Screenshot 2024-02-06 at 9.59.43 AM.png (65.1 KB)

I ran all of this and it did not fix the issue.

Can we schedule a call with an Aspose engineer to work through this?

@acn,

We are sorry, but we do not provide technical support via phone or online meetings in most cases. The best way to get assistance with your requirements/issue is through forums. As requested earlier, what is your operating system? Also, could you please check the regional and language settings on your computer and provide complete details?

Screenshot 2024-02-06 at 5.43.00 PM.png (14.0 KB)

I figured it out, sort of. I switched to an ubuntu image using the requirements, and got it to work. However, I still can’t seem to get the save format cells.SaveFormat.EXCEL_97_TO_2003 to work when saving to a stream. Is this format still supported in v 24.1.0? I am having the same issue with aw.SaveFormat.DOC when working with word documents, though not with slides.export.SaveFormat.PPT, which works fine with a stream output.
Screenshot 2024-02-06 at 5.42.40 PM.png (43.5 KB)

@acn
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): CELLSPYTHONNET-188

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

Thank you. I got an email notification about another response you had posted including a code snippet you said worked on your end. Is that still true? The following is the message available via email but that I can’t see on here.

@acn
SaveFormat.EXCEL_97_TO_2003 format is supported, and the code below runs correctly on our side. Please try running it as well. If there are any issues, please contact us.

with open('Book1.xls', 'rb') as file:
    input_stream = io.BytesIO(file.read())
workbook = Workbook(input_stream)
out_stream = io.BytesIO()
workbook.save("Book1_2003.xls", SaveFormat.EXCEL_97_TO_2003)
out_bytes = out_stream.getvalue()
out_stream.close()

Actually I see now that you only tested using a stream to input the file, not to save it. Can you confirm saving to a stream with EXCEL_97_TO_2003 failed on your end as well?

@acn
Yes, it works fine if we save the input stream as an EXCEL_97_TO_2003 format file.
But if we try to save the input stream to a stream with EXCEL_97_TO_2003, the error “Proxy error(NotSupportedException)” indeed occurs. However, saving to the output stream in other formats works fine. Therefore, we created the ticket CELLSPYTHONNET-188.Apologies for the confusion caused.

@acn
We are pleased to inform you that your issue (logged earlier as"CELLSPYTHONNET-188") has been resolved. The fix/enhancement will be included in our upcoming release (v24.3 package) that we plan to publish in the first half of March (next month). You will be notified when the next version is released.

The issues you have found earlier (filed as CELLSPYTHONNET-188) have been fixed in Pypi. This message was posted using Bugs notification tool.