Product exports from German or French spreadsheets often contain prices like 12,90 or 1.299,00 € . Shopify expects 12.90 and 1299.00 , so an import with the wrong format fails or gives wrong prices. Here is a small script that normalizes one price column and tells you which rows it could not parse.
The rules
Remove spaces, non-breaking spaces and currency symbols.
If both , and . appear, the last one is the decimal separator.
If only a comma appears, it is the decimal separator.
Anything that is not digits with at most two decimals afterwards is reported, not guessed.
The script
import csv , re , sys
def normalize ( value ) : v = value . strip ( ) . replace ( "\u00a0" , "" ) . replace ( " " , "" ) v = re . sub ( r "[€$£]|EUR|USD" , "" , v ) if not v : return None if "," in v and "." in v : if v . rfind ( "," ) > v . rfind ( "." ) : v = v . replace ( "." , "" ) . replace ( "," , "." ) else : v = v . replace ( "," , "" ) elif "," in v : v = v . replace ( "," , "." ) if not re .…