I have a python script parses excel data and formats it for further processing. Once of the excel cells has data that is just an array of fields.
My goal is to turn this mess into an simple bulleted list (grouping the different attributes by their function)
Example Cell Value :
"Additional Info":"Water Tight"|"Diameter":"3"|"Material":"Porcelain"|"Ship Carton Height":"18"|"Ship Carton Length":"11"|"Ship Carton Width":"18"|"Ship Weight":"10"|"Sold By":"S/2"|"Weight":"5"|"Assembly Instructions":"No"|"Care instructions":"Use a soft dry cloth"|"Color":"Blue"|"Contract Suitable As Is":"Yes"|"Country Of Origin":"PORTUGAL - PT"|"Finish Will vary":"Yes"|"Footprint":"1: 8.5 x 8
2: 13.5 x 6.5"|"Notes 1":"WATER TIGHT"|"Overall Diameter":"1: 6.5 Dia
2: 8 Dia"|"Overall Dimensions Height":"H1: 13.5
H2: 8.5"|"Overall Dimensions Width":"W1: 6.5 Dia
W2: 8 Dia"|"Overall Shape":"Round"|"RoHS":"No"|"Top Coat":"No"|"TruckShip":"Pass"
I'm trying to convert into the following format :
- Additional Info : Water Tight
- Diameter : 3
- Overall Diameter : 1: 6.5 Dia 2: 8 Dia
I'm having trouble extracting the information that is between the quotes into variables.
So "Additional Info":"Water Tight" would produce 2 values, Additional Info = attribute name and Water Tight = attribute value.
What I tried : Converting the entire cell into a string and then splitting it on the pipe character and then again on the colon. However, this doesn't work when there is a value like : "Overall Dimensions Height":"H1: 13.5 H2: 8.5"
The other thing to note is that the values in the cell will change (somtimes there are more, sometimes there are less). But they always follow the same format : "Attribute Title ":"Attribute Value | "Attribute Title2 ":"Attribute Value2..."
Any ideas on how I can do this?