How to format CSV for importing "List of single line text" metafield values?

Hi Shopify community!

I’m trying to import product data via CSV that includes a metafield which is set up as a “List of single line text”.

My metafield setup:

  • Name: Features
  • Type: List of single line text
  • Namespace/Key: custom.features

In the Shopify admin, I can manually add multiple items to this list by clicking “Add item”, creating separate text fields for each feature. However, I’m not sure how to format this in my CSV file for bulk import.

For example, if I want to import a product with 5 features, what’s the correct CSV column header and value format that will create separate list items (instead of putting all features in a single line)?

I’ve tried various formats but none create separate list items like the manual “Add item” interface does.

Can anyone share the correct CSV format for importing multiple values into a “List of single line text” metafield?

Thank you!

1 Like

I have the same issue. I found out the format during an export. There is a “linebreak” in the cell which you can make with [alt] + [enter].

However this is not pratical whilst working with bulk operations covering thousands products! Anyone?

Skjermbilde 2025-02-28 000251.png

Hello!

Did you manage to resolve this issue? I am trying to create a script that takes json product data and places it into the csv, but I have this issue that it throws this error: “Validation failed: Owner subtype does not match the metafield definition’s constraints.” Whatever divider I have also used ‘\n’. Any suggestions?

I used Chatgpt to write a macro I used in Excel:

Sub SettInnLinjebreak()

Dim tekst As String

Dim startCell As Range

Dim rng As Range

Dim cell As Range

’ Sett markøren til ønsket startcelle i B-kolonnen

Set startCell = ActiveCell

’ Sett området i A-kolonnen fra startcellens rad til siste rad (A1:A550)

Set rng = Range(“A” & startCell.Row & “:A550”)

’ Initialiser tekstvariabelen

tekst = “”

’ Loop gjennom cellene i området og bygg opp teksten med linjeskift

For Each cell In rng

If cell.Value <> “” Then

tekst = tekst & cell.Value & Chr(10) ’ Chr(10) setter inn linjeskift

Else

Exit For ’ Stopp når vi treffer første tomme celle

End If

Next cell

’ Fjern siste linjeskift hvis teksten ikke er tom

If Len(tekst) > 0 Then

tekst = Left(tekst, Len(tekst) - 1)

End If

’ Sett den sammenlagte teksten inn i den aktive cellen i B-kolonnen

startCell.Value = tekst

startCell.WrapText = True ’ Aktiver “Wrap Text” i målcellen

End Sub

If you put it into Chatgpt it will give you an explanation how the macro works.

Good luck.

1 Like