Merge & Center

In the middle of the process i need to “merge & center” this process.
I had try many method such as - Add depencies for Merge cells , Invoke VBA but it fail to process.
Anyone can help to solve my issue ?

@yfbeh

I have not seen any direct activities to perform this operation.

First, check if there are any marketplace activities available (most likely not available).

Another option is to do via Ui Automation that is open excel merge and then save & close.

You could try attached workflow
XlsRangeMerge.xaml (9.3 KB)

Cheers

I might possible through invoke python script
Just play with:

Input Parameters:New List(Of Object) {filePath, “Sheet1”, “A1:B1”, “Your Text”}

from openpyxl import load_workbook
from openpyxl.styles import Alignment

def merge_and_center(file_path, sheet_name, merge_range, text=None):
wb = load_workbook(file_path)
ws = wb[sheet_name]
ws.merge_cells(merge_range)
top_left_cell = ws[merge_range.split(‘:’)[0]]
if text:
top_left_cell.value = text
top_left_cell.alignment = Alignment(horizontal=‘center’, vertical=‘center’)
wb.save(file_path)
print(f’Merged {merge_range} and centered text in {file_path}')

merge_cells.py

Invoke python method

Play around this to achieve desired results.