xxxxxxxxxx
' A2 = "aaaa-bbb-ccc"
' First column / item, separator "-" -> aaaa
=LEFT(A2, SEARCH("-",A2,1)-1)
' Middle column / item -> bbb
=MID(A2, SEARCH("-",A2) + 1, SEARCH("-",A2,SEARCH("-",A2)+1) - SEARCH("-",A2) - 1)
' Last column / item -> ccc
=RIGHT(A2,LEN(A2) - SEARCH("-", A2, SEARCH("-", A2) + 1))
xxxxxxxxxx
import openpyxl
# Load the Excel file
workbook = openpyxl.load_workbook('your_file.xlsx')
# Select the specific sheet
sheet = workbook['Sheet1']
# Get the cell containing the text
cell = sheet['A1']
# Split the text using a delimiter (e.g., comma)
split_text = cell.value.split(',')
# Write the split text into separate cells
for index, text in enumerate(split_text):
sheet.cell(row=cell.row, column=cell.column + index).value = text
# Save the modified Excel file
workbook.save('your_modified_file.xlsx')
xxxxxxxxxx
1) Select the cell or column to split.
2) Go to "Data" tab > Click "Text to Columns" icon
3) In the Convert Text to Columns Wizard, select Delimited > Next.
4) Select the "Delimiter"s for your data > Next.
5) Select the Destination / Provide destination start address > Finish