Tranform a complex TXT file in a proper usuable format

attached a file ( from SAP financial report ) that i want to transform in a proper usuable format like:

assets | fixed assets | II intangible assets | 21000000 | immaterial fixed assets | 650.000 | 650.000
like a sort of a level drill down
level 1 = assets
level 2 = fixed assets
level 3 = III tangible fixed assets
level 4 = C. furniture and vehicles
level 5 = account # 24000000
level 6 = account name furniture and fixtures
I don’t need the amounts I
this is a template for one particular financial statement I have more than 50 to handle so I appreciate a dynamic solution
thanks in advance Roger
chart of accounts subsiderie.txt (47.0 KB)

Hi @Roger,

I’m always looking for patterns and or elements to exploid but from my point of view this needed to be build Col by Col if that can live up to your “dynamic” criteria will be a matter of opinion…

IMPORTANT this is not a full solution, these areas require your attention:

  • The first 2 col texts are still spaced, but you can easily replace those values
  • The final rows in L2 contain “T O T A L L I A B I L I T I E S :” I’m pretty sure you’ll want to replace that
  • Some category names were split over multiple lines, its easier to correct that afterwards

If you’re okay with these limitations then you have a starting point :wink:

This is what it looks like now.

Here’s the PBIX just update the FileLocation parameter to restore the query.
eDNA - CoA Roger.pbix (13.6 KB)
,
I hope this is helpful