<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic how to create borders in excel by python in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/how-to-create-borders-in-excel-by-python/m-p/11501#M6449</link>
    <description>&lt;P&gt;how to create borders in excel by python like the following format.&lt;/P&gt;&lt;P&gt;​&lt;/P&gt;&lt;P&gt;in the ex column if i entered the value as data means it should be center between those rows.​&lt;/P&gt;&lt;P&gt;​&lt;/P&gt;&lt;P&gt;​&lt;/P&gt;</description>
    <pubDate>Tue, 17 Jan 2023 16:33:00 GMT</pubDate>
    <dc:creator>databicky</dc:creator>
    <dc:date>2023-01-17T16:33:00Z</dc:date>
    <item>
      <title>how to create borders in excel by python</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-create-borders-in-excel-by-python/m-p/11501#M6449</link>
      <description>&lt;P&gt;how to create borders in excel by python like the following format.&lt;/P&gt;&lt;P&gt;​&lt;/P&gt;&lt;P&gt;in the ex column if i entered the value as data means it should be center between those rows.​&lt;/P&gt;&lt;P&gt;​&lt;/P&gt;&lt;P&gt;​&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2023 16:33:00 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-create-borders-in-excel-by-python/m-p/11501#M6449</guid>
      <dc:creator>databicky</dc:creator>
      <dc:date>2023-01-17T16:33:00Z</dc:date>
    </item>
    <item>
      <title>Re: how to create borders in excel by python</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-create-borders-in-excel-by-python/m-p/11502#M6450</link>
      <description>&lt;P&gt;@Mohammed sadamusean​&amp;nbsp;:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can use the openpyxl library in Python to create borders in Excel. Here is an example code snippet that creates a border around a range of cells and centers the text in a specific column:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;import openpyxl
from openpyxl.styles import Border, Side, Alignment
&amp;nbsp;
# Load the Excel workbook
wb = openpyxl.load_workbook('example.xlsx')
&amp;nbsp;
# Select the worksheet
ws = wb.active
&amp;nbsp;
# Create a border for the range of cells A1:C5
border = Border(left=Side(style='thin'), 
                right=Side(style='thin'), 
                top=Side(style='thin'), 
                bottom=Side(style='thin'))
&amp;nbsp;
for row in range(1, 6):
    for col in range(1, 4):
        cell = ws.cell(row=row, column=col)
        cell.border = border
        
# Center align the values in column E
for row in range(1, 6):
    cell = ws.cell(row=row, column=5)
    cell.alignment = Alignment(horizontal='center')
&amp;nbsp;
# Save the workbook
wb.save('example.xlsx')&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;In this example, we load an existing workbook, select the active worksheet, create a border for the range of cells A1:C5, and center align the values in column E. Finally, we save the workbook.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Apr 2023 15:18:20 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-create-borders-in-excel-by-python/m-p/11502#M6450</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-04-10T15:18:20Z</dc:date>
    </item>
  </channel>
</rss>

