If I understood your question correctly, you're trying to import an Excel containing 2 columns into Azure Databricks which is expecting 3 columns. In this scenario, if your Excel file has fewer columns than you are expecting, you may encounter an error when you try to read the file into Azure Databricks. The error message will depend on the specific method you are using to read the file, but it will likely indicate that the file has fewer columns than expected. One possible way to resolve this issue is to import the Excel containing 2 columns as a dataframe with 2 columns and then using the withColumn() to add the additional column to the dataframe. Your statement would be like this: df = df.withColumn("new_column", lit(None).cast("string")) Alternatively, you can add the additional column in the Excel before importing it.
If the Answer is helpful, please click "Accept Answer" and upvote it.