Make an XML file from multiple lines in Google Spreadsheets

I have a sheet list that contains several products.
Now I want to create an XML file from it.
Unfortunately, Make splits each line into an XML file.

How can I avoid this?

My Scenario

The XML


<artikel_list>

512039
92
<lager_platz>Hive</lager_platz>
10.10.2025
test 123 123123


</artikel_list>

Hey @Cailban
Welcome to the Make Community.

Can you pls share the data of the google sheet and the output you actually want.

Thanks,
Sachin Shrivastava

3 Likes

Hey @sachin.shrivastava
Thanks for the very quick response :slight_smile:

You should first change it to .csv then change it to xml, It will work well.

2 Likes

Every result (item/record) from a search module will output a bundle. To “combine” them into a single structure, you’ll need to use an aggregator of some sort.

Aggregators are modules that accumulate multiple bundles into one single bundle. An example of a commonly-used aggregator module is the Array aggregator module. The next popular aggregator is the Text Aggregator which is very flexible and has applies to many use-cases.

There are other types of aggregator modules, like the CSV aggregator mentioned above, click the below links to find out more:

2 Likes

But then I only get a text as an item

Can anyone help?
What I always get is single file like this:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<response>
  <xml>
    <artikel_list>
      <artikel>
        <mhd>10.10.2025</mhd>
        <charge>8668</charge>
        <nummer>512038</nummer>
        <lagerzahl>90</lagerzahl>
        <lager_platz>Hive</lager_platz>
      </artikel>
    </artikel_list>
  </xml>
</response>

I need this:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<response>
  <xml>
    <artikel_list>
      <artikel>
        <mhd>10.10.2025</mhd>
        <charge>8668</charge>
        <nummer>Artikel 1</nummer>
        <lagerzahl>90</lagerzahl>
        <lager_platz>Lager</lager_platz>
      </artikel>
      <artikel>
        <mhd>10.10.2025</mhd>
        <charge>8668</charge>
        <nummer>Artikel 2</nummer>
        <lagerzahl>90</lagerzahl>
        <lager_platz>Lager</lager_platz>
      </artikel>
    </artikel_list>
  </xml>
</response>

Hi @Cailban,

If you need further assistance, please provide the following:

Please provide the output bundles of the module [3] “Search Rows” by running the scenario, then click the white speech bubble on the top-right of the module and select “Download output bundles”.
Screenshot_2023-10-06_141025

A.

Save the bundle contents in your text editor as a bundle.txt file, and upload it here into this discussion thread.
Uploading it here will look like this:

bundle.txt (12.3 KB)

B.

If you are unable to upload files on this forum, alternatively you can paste the formatted output bundle in this manner:

  • Either add three backticks ``` before and after the code, like this:

    ```
    input/output bundle content goes here
    ```

  • Or use the format code button in the editor:
    Screenshot_2023-10-02_191027

Providing the output bundles will allow others to replicate what is going on in the scenario even if they do not use the external service. This also avoids assumptions about your data and us going in circles.

This will allow others to better assist you. Thanks!

1 Like

Thank you for the feedback. Here is the TXT file

[
    {
        "0": "512038",
        "1": "Testartikel 1",
        "2": "B-Z-111",
        "3": "8668",
        "4": "90",
        "5": "16.10.2025",
        "__ROW_NUMBER__": 2,
        "__SPREADSHEET_ID__": "1kweqbYGYp2AxjFoFjAkquJ-QD_DWB8Y6gW5vifo-6cQ",
        "__SHEET__": "Tabellenblatt1",
        "__IMTLENGTH__": 2,
        "__IMTINDEX__": 1
    },
    {
        "0": "512039",
        "1": "Testartikel 2",
        "2": "B-Z-112",
        "3": "8668",
        "4": "110",
        "5": "16.10.2024",
        "__ROW_NUMBER__": 3,
        "__SPREADSHEET_ID__": "1kweqbYGYp2AxjFoFjAkquJ-QD_DWB8Y6gW5vifo-6cQ",
        "__SHEET__": "Tabellenblatt1",
        "__IMTLENGTH__": 2,
        "__IMTINDEX__": 2
    }
]

This is how I might do it.

1. Aggregate to text

2. Put aggregated items into XML


Modules

You can copy and paste this module export into your scenario. This will paste the modules shown in my screenshots above.

  1. Copy the code below by clicking the copy button when you mouseover the top-right of the code block
    Screenshot_2024-01-17_200117

  2. Enter your scenario editor. Press ESC to close any dialogs. Press CTRLV to paste in the canvas.

  3. Click on each imported module and save it. You may need to remap some variables.

Modules JSON Export

{
    "subflows": [
        {
            "flow": [
                {
                    "id": 17,
                    "module": "util:TextAggregator",
                    "version": 1,
                    "parameters": {
                        "rowSeparator": "\n",
                        "feeder": 19
                    },
                    "mapper": {
                        "value": "      <artikel>\n        <mhd>{{19.`5`}}</mhd>\n        <charge>{{19.`3`}}</charge>\n        <nummer>{{19.`1`}}</nummer>\n        <lagerzahl>{{19.`4`}}</lagerzahl>\n        <lager_platz>{{19.`2`}}</lager_platz>\n      </artikel>"
                    },
                    "metadata": {
                        "designer": {
                            "x": 215,
                            "y": -122
                        },
                        "restore": {
                            "parameters": {
                                "rowSeparator": {
                                    "label": "New row"
                                }
                            },
                            "extra": {
                                "feeder": {
                                    "label": "Google Sheets - Search Rows [19]"
                                }
                            },
                            "flags": {
                                "groupBy": {
                                    "collapsed": true
                                }
                            }
                        },
                        "parameters": [
                            {
                                "name": "rowSeparator",
                                "type": "select",
                                "label": "Row separator",
                                "validate": {
                                    "enum": [
                                        "\n",
                                        "\t",
                                        "other"
                                    ]
                                }
                            }
                        ],
                        "expect": [
                            {
                                "name": "value",
                                "type": "text",
                                "label": "Text"
                            }
                        ],
                        "advanced": true
                    },
                    "flags": {
                        "stopIfEmpty": true
                    }
                },
                {
                    "id": 18,
                    "module": "util:SetVariable2",
                    "version": 1,
                    "parameters": {},
                    "mapper": {
                        "name": "XML",
                        "scope": "roundtrip",
                        "value": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<response>\n  <xml>\n    <artikel_list>\n{{17.text}}\n    </artikel_list>\n  </xml>\n</response>"
                    },
                    "metadata": {
                        "designer": {
                            "x": 460,
                            "y": -126
                        },
                        "restore": {
                            "expect": {
                                "scope": {
                                    "label": "One cycle"
                                }
                            }
                        },
                        "expect": [
                            {
                                "name": "name",
                                "type": "text",
                                "label": "Variable name",
                                "required": true
                            },
                            {
                                "name": "scope",
                                "type": "select",
                                "label": "Variable lifetime",
                                "required": true,
                                "validate": {
                                    "enum": [
                                        "roundtrip",
                                        "execution"
                                    ]
                                }
                            },
                            {
                                "name": "value",
                                "type": "any",
                                "label": "Variable value"
                            }
                        ],
                        "interface": [
                            {
                                "name": "XML",
                                "label": "XML",
                                "type": "any"
                            }
                        ]
                    }
                }
            ]
        }
    ],
    "metadata": {
        "version": 1
    }
}

@samliew Would there be a way to dynamically update an XML structure based on the number of inputs? For example, I want to set up a time-based scenario where every 5 days the rows in a google sheet which have the Approval column cell set to “Approved”, and only if the cell has been changed to “Approved” within those 5 days, then the fields within those rows should be inserted into a predefined xml structure. Since the amounts of rows approved won’t be the same every 5 days is there a way to dynamically update the set xml structure based on the amount of rows with the “Approved” status?

That looks like a new question, could you please create a separate topic for this?

While it’s tempting to spam an existing thread, a more effective approach would be to start a new topic just for your question. It helps community experts find and respond to your query quicker, and keeps our space organised for everyone. If you start a new conversation you are also more likely to get help from other users. You can refer others back to a related topic by including that link in your question. Thank you for understanding and keeping our community neat and tidy.

The “New Topic” link can be found in the top-right of the header:

Screenshot_2023-12-19_091207