Hi all,
I’ll start by listing my steps, as I’ve forgotten to do so my last few posts.


(START OF CODE FOR STEP 3)
import re
description = inputData.get('description', '')
# Enhanced size codes including new ones (case sensitive)
size_codes = [
'AXL', 'YSM', 'YXL', 'A2XL', 'AXS', 'W2XL', 'ALG', 'AMD', 'ASM', 'A2X', 'WXL',
'YMD', 'A3XL', 'A4XL', 'A3X', 'A4X', 'WXS', 'WSM', 'WMD', 'WLG', 'W3XL', 'W4XL', 'YLG'
]
# Color codes to recognize (case insensitive matching)
color_codes = [
'ATHLETIC HEATHER', 'Grey Concrete', 'MAROON', 'CHARCOAL', 'HEATHERED NAVY', 'DENIM',
'IVORY', 'GREY', 'NAVY', 'BLACK', 'LIGHT BLUE', 'OXFORD', 'Athletic Heather Grey',
'Dark Heather Grey', 'CAROLINA BLUE', 'GREY CONCRETE HEATHER', 'Heathered Red',
'RAINBOW', 'PINK', 'White', 'Butter', 'Chalky Mint', 'Crunchberry', 'Lagoon',
'Melon', 'Granite', 'GOLD', 'LAVENDER', 'PURPLE', 'HEATHERED PURPLE', 'Crimson',
# Additional common colors
'RED', 'BLUE', 'GREEN', 'YELLOW', 'ORANGE', 'BROWN', 'TAN', 'BEIGE', 'KHAKI',
'FOREST GREEN', 'ROYAL BLUE', 'BURGUNDY', 'SILVER', 'CORAL', 'MINT', 'SAGE',
'PEACH', 'CREAM', 'SAND', 'STONE', 'SLATE', 'TEAL', 'TURQUOISE'
]
found_sizes = []
remaining_text = str(description)
# Find and remove ALL size codes (case sensitive) using exact word boundaries
for size in size_codes:
# Use word boundaries to match exact size codes, not partial matches
pattern = r'\b' + re.escape(size) + r'\b'
matches = re.findall(pattern, str(description))
count = len(matches)
if count > 0:
found_sizes.extend([size] * count)
# Remove size from remaining text using word boundaries
remaining_text = re.sub(pattern, '', remaining_text)
remaining_text = remaining_text.strip()
# Find ALL recognized colors in remaining text (case insensitive) - count duplicates
found_colors = []
for color in color_codes:
count = remaining_text.upper().count(color.upper())
if count > 0:
found_colors.extend([color] * count)
# Size output: join all found sizes with commas, or empty string if none
size_output = ', '.join(found_sizes) if found_sizes else ''
# Color output: join all found colors with commas, or use remaining text if none found
color_output = ', '.join(found_colors) if found_colors else remaining_text
output = {'size': size_output, 'color': color_output}
(END OF CODE)

Those are my steps and the configurations. Here is my issue:
Below is my wix order I am using as an example.

Now, this is what is being output into my spreadsheet.

The webhook does gather the right data, and the spreadsheet DOES gather all the right size and color data, but I’m not sure how to code it or do a step that puts said data into the right row. I need each item to have one size and one color, or neither like the duffel which lacks options. But I’m not sure how to go about that… every modification I make to the loop or the code leaves the spreadsheet with no size or data input, or sometimes with no item names at all.