Last active
February 15, 2026 06:04
-
-
Save aspose-com-kb/c4825ef99a5b7273a1c426dc15bc7f88 to your computer and use it in GitHub Desktop.
Add Threaded Comments in Excel using Python. For details: https://kb.aspose.com/cells/python/add-threaded-comments-in-excel-using-python/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import aspose.cells as ac | |
| def main(): | |
| # Apply Aspose.Cells license | |
| license = ac.License() | |
| license.set_license("license.lic") | |
| # Create a workbook and get the first worksheet | |
| workbook = ac.Workbook() | |
| sheet = workbook.worksheets[0] | |
| # Add a value to cell A1 | |
| sheet.cells.get("A1").put_value("Hello") | |
| # Create an author for threaded comments | |
| authors = workbook.worksheets.threaded_comment_authors | |
| author_index = authors.add("Aspose Test", "", "") | |
| author = authors[author_index] | |
| # Add a threaded comment to cell A1 | |
| sheet.comments.add_threaded_comment("A1", "Test Threaded Comment", author) | |
| # Save the Excel file | |
| workbook.save("AddThreadedComments_out.xlsx") | |
| print("Threaded comment added successfully.") | |
| if __name__ == "__main__": | |
| main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment