I am trying to organise a column by filtering the values. In other words, there are thousands of repetitive names and I want to take just one name from each "group" and copy it in a other column.
So the column A is the current situation and the column be is the result I want to get:
Column A Column B
AB Mark Sociedad Ltda AB Mark Sociedad Ltda
AB Mark Sociedad Ltda Acosta Acosta Manuel
AB Mark Sociedad Ltda ALBAGLI, ZALIASNIK
AB Mark Sociedad Ltda
Acosta Acosta Manuel
Acosta Acosta Manuel
Acosta Acosta Manuel
ALBAGLI, ZALIASNIK
ALBAGLI, ZALIASNIK
ALBAGLI, ZALIASNIK
Finally this is the script I am trying to use:
import openpyxl
from openpyxl import load_workbook
import os
os.chdir('path')
workbook = openpyxl.load_workbook('abc.xlsx')
page_i = workbook.get_sheet_names()
sheet = workbook.get_sheet_by_name('Sheet1')
for a in range(1, 10):
representativex = sheet['A' + str(a)].value
tuple(sheet['A1':'A10'])
for row in sheet['A1':'A10']:
if representativex in row:
continue
else:
sheet['B' + str(a)].value
sheet['B' + str(a)] = representativex
workbook.save('abc.xlsx')
Unfortunately it doesn't work.

