Read info from a file to generate groups

Team,
I would like to create dynamically groups at Home Assistant startup

I’ve seen here that it should be possible:Auto-generated Groups of Sensors/Lights per room - #10 by 123

BUT how I would create them is different.
I would like to have a file where I have
entity id - group (commas separated, taml, csv, any format is ok) and read all the lines to add the correct entity to the correct group
the question is: how can I read such file?

any idea or help?

In the linked example, replace the entities template with an !include that points to a file containing the group’s members (name the file whatever you want).

  - service: group.set
    data:
      name: 'Kitchen Power Sensors'
      entities: !include kps.yaml

The contents of kps.yaml should look like a YAML list.

- sensor.one
- sensor.two
- sensor.etc

Be advised I have not tested it and it’s based on something I saw elsewhere (but can’t find it now).