Insert Background Image to Excel

How to Sett Sheet Background in Microsoft Excel

To set a sheet’s background image in Microsoft Excel (for example, Microsoft Excel 2019):

  1. From the Page Layout menu, find the Page Setup option, and then click the Background option.

  2. Select a picture to set the sheet’s background picture.

    Setting a sheet background

todo:image_alt_text

How to Set Sheet Background with Aspose.Cells for Python Excel Library

The code below sets a background image using an image from a stream.

from aspose.cells import SaveFormat, Workbook
# For complete examples and data files, please go to https:# github.com/aspose-cells/Aspose.Cells-for-.NET
# Create a new Workbook.
workbook = Workbook()
# Get the first worksheet.
sheet = workbook.worksheets[0]
# Set the background image for the worksheet.
sheet.background_image = open("background.jpg", "rb").read()
# Save the Excel file
workbook.save("outputBackImageSheet.xlsx")
# Save the HTML file
workbook.save("outputBackImageSheet.html", SaveFormat.HTML)