Format import text from spreadsheet
-
Great plugin.
I had to import a few hundred categories and it worked great. To ease the formatting, I wrote a small script for Google Sheets (it probably also works in Excel). It might be handy for other users. This only handles the non-alphanumeric characters I had to deal with in this project and may need to be adjusted to suit your exact needs.
Columns ABC contain the 3 levels of categories. Column D contains the code below. The value of column D can be copied into Category Import Reloaded.
=regexreplace(A2, "/", "&.#047;")&"$"®exreplace(regexreplace(LOWER(A2), " |\.|\,|/|&", "-"), "---|--", "-")&IF(B2<>""," / "®exreplace(B2, "/", "&#.047;")&"$"®exreplace(regexreplace(LOWER(B2), " |\.|\,|/|&", "-"), "---|--", "-"),"")&IF(C2<>""," / "®exreplace(C2, "/", "&#.047;")&"$"®exreplace(regexreplace(LOWER(C2), " |\.|\,|/|&", "-"), "---|--", "-"),"")
What it does:
1. Replace slashes in label with html entity
2. Sanitizes the slug
a. replace space, period, comma, slash, ampersand with hyphen.
b. replace multiple hyphens with single hyphen.
3. Combines everything in a single string
- The topic ‘Format import text from spreadsheet’ is closed to new replies.