+ Reply to Thread
Results 1 to 7 of 7

Yaml Parser for specific input file

Hybrid View

jaryszek Yaml Parser for specific... 06-30-2019, 07:24 AM
Pepe Le Mokko Re: Yaml Parser for specific... 06-30-2019, 09:31 AM
AliGW Re: Yaml Parser for specific... 06-30-2019, 09:43 AM
Marc L Hi ! So VBA is not the... 06-30-2019, 09:52 AM
jindon Re: Yaml Parser for specific... 06-30-2019, 10:31 PM
Marc L Hey Gindon ! Now I can see... 06-30-2019, 11:13 PM
jaryszek Re: Yaml Parser for specific... 07-01-2019, 01:20 AM
  1. #1
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,946

    Yaml Parser for specific input file

    Hi,

    i have input file like here (i can change for users input form for other shape, maybe any propositions?)

    Screenshot_24.png

    and i want is to get yml or txt file(because later i can take txt file and save as yml file) in this pattern:

    Screenshot_25.png


    position-country:
      name: position-country
      label: Position country
      type: select
      orderby: menu_order
      terms:
        - pl:
            slug: pl
            name: Poland
            icon: iconPath
        - de:
            slug: de
            name: Germany
            icon: iconPath
        - ru:
            slug: ru
            name: Russia
            icon: iconPath
            
     project-framework:
      name: project-framework
      label: Project framework
      type: select
      orderby: menu_order
      terms:
        - prince2:
            slug: prince2
            name: Prince2
            icon: iconPath
        - pmbook:
            slug: pmbook
            name: PMBook
            icon: iconPath
    can anybody help? What code can handle it?
    thank you in advance!
    Jacek
    Attached Files Attached Files

  2. #2
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,610

    Re: Yaml Parser for specific input file

    What does YamlParser mean?

  3. #3
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2503 (Windows 11 Home 24H2 64-bit)
    Posts
    90,518

    Re: Yaml Parser for specific input file

    Here’s what Google found:

    https://yaml.org/
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  4. #4
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow

    Hi !

    So VBA is not the easy language for that …

    And without any explanation neither an expected result file : I'm out !

  5. #5
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: Yaml Parser for specific input file

    Just for source workbook and the result that you want.
    Sub test()
        Dim a, e, i As Long, ii As Long, txt As String, w
        Const delim As Long = 2
        With Cells(1).CurrentRegion
            .Sort .Cells(1), 1, , , , , , 1
            a = .Value
        End With
        a(1, 7) = Split(a(1, 7), "/")(0)
        With CreateObject("Scripting.Dictionary")
            .CompareMode = 1
            For i = 2 To UBound(a, 1)
                For ii = 1 To 5
                    txt = txt & Chr(2) & a(i, ii)
                Next
                If Not .exists(txt) Then
                    ReDim w(1 To 6): w(6) = Space(delim) & "terms:"
                    For ii = 1 To 5
                        w(ii) = IIf(ii = 1, a(i, ii) & ":", Space(delim) & _
                                a(1, ii) & ": " & a(i, ii))
                    Next
                Else
                    w = .Item(txt)
                End If
                ReDim Preserve w(1 To UBound(w) + 1)
                w(UBound(w)) = Space(delim * 2) & "- " & a(i, 6)
                For ii = 7 To 9
                    w(UBound(w)) = w(UBound(w)) & vbNewLine & Space(delim * 3) & a(1, ii) & ": " & a(i, ii)
                Next
                .Item(txt) = w: txt = ""
            Next
            For Each e In .keys
                .Item(e) = Join(.Item(e), vbNewLine)
            Next
            Open ThisWorkbook.Path & "\test.txt" For Output As #1
                Print #1, Join(.items, vbNewLine & vbNewLine)
            Close #1
        End With
    End Sub
    Quote Originally Posted by Mark L
    I'm out !
    I don't think you are IN anyway.

  6. #6
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow

    Hey Gindon !

    Now I can see the pictures of initial post, maybe I had a network issue …

  7. #7
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,946

    Re: Yaml Parser for specific input file

    I don't think you are IN anyway.
    :D

    hi jindon,

    thank you very much!
    Awesome!

    Jacek

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Data Parser
    By ajocius in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-23-2017, 09:40 AM
  2. Excel/Access VBA parser help
    By Pettr in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-25-2013, 01:56 AM
  3. Network Config File to .xlsx Parser
    By willmccutcheon in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-12-2012, 10:37 AM
  4. Parser Code Optimization
    By excelforum123 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-25-2010, 09:08 AM
  5. Name Parser
    By tek in forum Excel General
    Replies: 1
    Last Post: 07-06-2007, 07:16 AM
  6. Excel 4.0 parser
    By JScoobyCed in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-24-2005, 04:10 PM
  7. Excel Parser
    By Mary Willis in forum Excel General
    Replies: 0
    Last Post: 01-13-2005, 11:40 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1