Writing to an Excel File (openpyxl module):

As we have seen in the previos article openpyxl is a library in Python for reading and writing in excel.  The module openpyxl allows a program in Python to read and modify the excel files for Data Science.

In the examples to follow, we will look at some of the codes to modify excel sheets using openpyxl.

Code 1: Printing an active sheet title name

Writing to an Excel File (openpyxl module) in Python for Data Science

Code 2: Changing the title name

Code3: Writing to an excel sheet

Writing to an Excel File (openpyxl module) in Python for Data Science

OUTPUT:

Writing to an Excel File (openpyxl module) in Python for Data Science

Code 4: Adding sheets in a workbook

OUTPUT:

So, if you want to learn more about python for data science then you can check this and this as well.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.