Solved

Move plain text metafield with some tags to html body

LottieKing
Visitor
2 0 2

I am in the middle of a rebuild and trying to move all my product descriptions across in bulk from a multi line text metafield back into the main description body html.

 

The data for the multi-line text metafield is only stored in Shopify as plain text data. When I use the app Matrixify to export this metafield it comes into an excel spreadsheet as plain text but with all line breaks present, in the same structure it appears on Shopify.

 

I can then import this plain text data through Matrixify into the body html and it will generate the line break tags for me. This works perfectly but I’m running into some trouble as the app Matrixify will not auto generate the line break tags if there are any html tags included in the plain text file.

 

Some of these plain text descriptions in my spreadsheet have html tags written into them, as my old theme would render these on my site.

 

Does anyone have a work around for moving plain text data with some written html into body html without loosing the line break information?

Accepted Solution (1)

Renars
Shopify Partner
291 32 342

This is an accepted solution.

Hi @LottieKing 

Renars here from Matrixify app. Thank you for using our app for this task and mentioning it here.

 

Found one solution which would be to use the Excel SUBSTITUTE formula to bulk replace the line breaks in the text with HTML `<br>` tags.

 

An example of the process could look like this:

  1. You have a file with this Metafield where you have new line rows in the Metafields value. In the column next to the Metafield (add new one if there is already data in there), in row 2 add formula `=SUBSTITUTE(F2,CHAR(10),"<br>")`. This formula will change any occurrence of a specific text within cells value with another text.
    There are 3 parts of this formula (see also my example screenshot below):
    • F2 - is the column and row of the metafields text (you would need to change the F to your Metafield columns letter/s).
    • CHAR(10) - is the formula for a new line character.
    • <br> - Replace with <br> for HTML line break.
  2. Fill that formula till the end of the file's data and you have generated the same metafield values but only with <br> tags where there was a line break in the text.

 

Renars_1-1715774772129.png

 

Then you can use this within the Body HTML column to add the value to the description but without line breaks.

 

Hope this helps!

Matrixify | Bulk Import Export Update | https://apps.shopify.com/excel-export-import | https://matrixify.app

View solution in original post

Replies 3 (3)

StephensWorld
Shopify Expert
1389 169 348

The only way I know of doing this for large amount of texts is via this tool: 

 

https://www.gillmeister-software.com/online-tools/text/remove-line-breaks.aspx

 

However, I don't think that'll work great for bulk editing products. When you do the original export via Matrixify, to get all of the metafields in a spreadsheet, you'd probably have to do a bunch of copy and pasting, where you run one cell at a time, via the link above, then paste the results back into the respective cell on the sheet. I don't think it'll handle splitting things up based on cells for you. 

★ Did my post help? If yes, then please like and accept solution. ★

https://stephens.world
support@stephensworld.ca

Renars
Shopify Partner
291 32 342

This is an accepted solution.

Hi @LottieKing 

Renars here from Matrixify app. Thank you for using our app for this task and mentioning it here.

 

Found one solution which would be to use the Excel SUBSTITUTE formula to bulk replace the line breaks in the text with HTML `<br>` tags.

 

An example of the process could look like this:

  1. You have a file with this Metafield where you have new line rows in the Metafields value. In the column next to the Metafield (add new one if there is already data in there), in row 2 add formula `=SUBSTITUTE(F2,CHAR(10),"<br>")`. This formula will change any occurrence of a specific text within cells value with another text.
    There are 3 parts of this formula (see also my example screenshot below):
    • F2 - is the column and row of the metafields text (you would need to change the F to your Metafield columns letter/s).
    • CHAR(10) - is the formula for a new line character.
    • <br> - Replace with <br> for HTML line break.
  2. Fill that formula till the end of the file's data and you have generated the same metafield values but only with <br> tags where there was a line break in the text.

 

Renars_1-1715774772129.png

 

Then you can use this within the Body HTML column to add the value to the description but without line breaks.

 

Hope this helps!

Matrixify | Bulk Import Export Update | https://apps.shopify.com/excel-export-import | https://matrixify.app
LottieKing
Visitor
2 0 2

Thanks Renars, the substitute formula in excel worked perfectly for this. I appreciate the help.