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
' 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 the necessary library
from openpyxl import load_workbook
# Load the Excel file
workbook = load_workbook('your_file.xlsx')
sheet = workbook['Sheet1'] # Replace 'Sheet1' with the actual sheet name
# Get the value from the cell
cell_value = sheet['A1'].value
# Split the cell value into multiple values based on a delimiter
delimiter = ' ' # Replace ' ' with your desired delimiter
values = cell_value.split(delimiter)
# Insert the split values into separate cells
for i, value in enumerate(values):
sheet.cell(row=1, column=i+2).value = value # Replace row=1 with the desired row number
# Save the changes to the Excel file
workbook.save('your_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