Error while deploying streamlit app that uses the xlwings library (streamlit cloud, huggingface, and render)

Hello Streamlit Community!
I have been hard at work developing a streamlit application that is a website adaptation of an excel worksheet my company uses to track product IDs.
The finished version runs perfectly and performs all expected features when ran locally.
However, I have been having plenty of trouble trying to deploy the application.
Particularly this error, regarding the use of the xlwings library:

xlwings.XlwingsError: Your platform only supports the instantiation via xw.Book(json=…)

This error appears with the traceback being my import statement:

bookwings = xl.Book(‘Product_Tracker.xlsm’)

and with that, it refuses to compile any further code.

I have consulted xlwings support on this and this is what one of their personnel had to say:

“xlwings’ default interactive mode depends on an installation of Excel. If you’re deploying your streamlit app, it’ll be installed on a Linux machine, which doesn’t have Excel installed.
On Linux, xlwings is only supported in the form of xlwings Server or in the read mode:”

With that being said: does anyone here have experience using xlwings for streamlit development and has successfully deployed an app with it?
If so, what hosting service did you use? (heroku, streamlit cloud, render, azure, etc.)
Did you make use of writing features like the ability to copy sheets and write into individual cells?

I am, unfortunately, hesitant to share the repository that I am working on, as it includes information confidential to my company’s work, which might prove troublesome if disclosed. I am, however, willing to provide any information about my code, requirements, failed deployment attempts etc.

Thank you all for your time, in advance.

Do you absolutely need xlwings for your tasks? There are some other Python libraries to work with Excel files without needing a local Excel installation, these are for example: pandas, xlsxwriter, openpyxl and others.

I do not, but I did consider all the options you listed and none of them provide some of the features I need, such as copying entire sheets, renaming them, and placing them in specific places in the notebook, and being able to call macros from within python to perform certain actions.
I’m current investigating into Pywin32 as an alternative, though I am by no means sure that it’s free of the issues that plague xlwings.
If anyone has an alternative that offers those features and is streamlit friendly, please bring it up.

This is almost certainly a dead end because it only runs on Windows and thus not on Streamlit Cloud or any other Linux server…
Besides, I don’t see what pywin32 should help with?

Now that you mention it, pywin32 might be useless.
I am considering any other alternatives, but the ones you listed are not the most in-line with my needs.
If you have any other options, please inform me.

As long as I don’t know more specific details about the entire workflow and the origin and destination of the data or Excel files, it will be difficult to make more concrete suggestions.

The workflow of the project goes as such:
Reading an excel file using pandas.
Running through user input to see if filters should be applied to the data frame.
Displaying the data frame as the user wants it and supplementary charts that reflect the data in its filtered/unfiltered state.
Xlwings is used if the user wanted to update the database (the pandas dataframe) with a new entry or edit a preexisting entry. It copies a product entry template sheet and modifies it by taking input via streamlit input widgets. After this is done, Xlwings provokes a macro in the excel document, which is used to update the table of contents if a new entry is added, then pandas updates to reflect the changed table of contents with an updated dataframe appearing on the streamlit page.

Again, what I would expect from an xl-wing like extension would be:
-Copying entire sheets, while reserving formatting and macros-related properties (which put Openpyxl out of the question)
-Interacting with macros and the xlsm file format (which renders xlsx writer unusable, to my knowledge)
-Being able to write to specific cells of specific sheets. (the easiest one, to be honest.)
-Saves the edited file and closes it instead of saving a new file of the exact same name and deleting the old file like Openpyxl does, since that confuses streamlit and disables macros.

Xlwings and Pywin32 seem to be a dead end as well, since streamlit deployment won’t allow them to run properly.

It truly might be an unsolvable predicament, or one that requires a massive overhaul of my code.

Question: Would deploying using docker or azure web services bypass this limitation? are they also running on a linux machine? does anyone know?

Hello, I am also facing the same issue as this one. It’s working fine on my local environment, but when I uploaded my code to FaaS it’s giving me the same problem [The interactive mode of xlwings is only supported on Windows and macOS. On Linux, you can use xlwings Server or xlwings Reader]. Tried reader and server, but still no luck. Im wondering if you figured out other workaround or solution regarding this? Please let me know. Thank you!