Watermarking is one of the common ways of protecting documents from unauthorized usage. More often, a watermark defines the ownership of the copyrighted content. In accordance with that, this article covers how to perform watermarking in Excel files programmatically. Particularly, you will learn how to add watermark to an Excel worksheet using Python.
- Python Library to Add Watermarks to Excel Worksheets
- Add a Watermark to Excel Worksheet
- Online Tool to Watermark Excel Files
Python Library to Add Watermarks to Excel Worksheets
Aspose.Cells for Python is a spreadsheet manipulation library that lets you create, modify or convert Excel files. We will use it to add watermark to the Excel worksheets. You can download the library or install it using the following pip command.
pip install aspose-cells
Add a Watermark to Excel Worksheet in Python
The following are the steps to add a watermark in an Excel worksheet using Python.
- First, load the Excel file using Workbook class by providing its path.
- Get reference of the Worksheet to which you want to add the watermark.
- Create a watermark by adding a new Shape to the worksheet and set the its text and properties.
- Set Shape.setLocked(boolean) property to true to lock the watermark.
- Set other lock types using Shape.setLockedProperty(ShapeLockType, boolean) method.
- Finally, save the updated Excel file using Workbook.save(String) method.
The following code sample shows how to add a watermark to an Excel worksheet.
Output
The following is the screenshot of the Excel worksheet after adding the watermark.
Get a Free License
You can use Aspose.Cells for Python without evaluation limitations using a temporary license.
Online Tool to Watermark Excel Files
Use our free online Excel watermarking tool, which is based on Aspose.Cells for Python. You can use this app from anywhere without signing up.
Conclusion
Watermarks are extensively used to prevent the illegal usage of copyrighted Excel files. Accordingly, in this article, you have learned how to add watermark to Excel worksheets using Python. In addition, we have provided you with a free online watermarking tool that let’s you add watermark on Excel sheets.
You can also explore other features of Aspose.Cells for Python using the documentation. In case you would have any queries, you can post on our forum.