Problem
You run the following code to install the xlwings
Python library in Databricks.
pip install xlwings
import xlwings as xw
app = xw.App(visible=False)
When you initialize, you receive the following error despite successfully installing and importing the package.
AttributeError: 'NoneType' object has no attribute 'apps'
Cause
The open-source xlwings
package automates a locally installed Excel application, so is designed to work on Windows and Mac operating systems.
Databricks clusters run on Linux. On Linux, there is no Excel process to control, as a result, any attempt to use xlwings.App()
, or similar functions that require Excel automation, fail.
Solution
Consider using xlwings Server
or xlwings Reader
, both of which are available with the xlwings PRO
version.
For more information, review the xlwings Installation documentation.