Sheet name variable within a loop

Hi,

I have a workflow which contains a loop to format data and then write the sheets to Excel. The Excel writer has 2 tabs per loop.

I want the tab names to be “Sample 1 lines”, “Sample 1 pivot”, “Sample 2 lines”, “Sample 2 pivot”, etc. but at the moment it just seems to be using the array string (e.g. "[Sample 1 lines, Sample 1 pivot]).

Is there a way to use a variable for the sheet names?

Thanks,
Beth

Hello Bethany_Duffy,

The component you are using has ‘\n’ as a delimiter in the Cell Splitter node, thus taking your input as a single string.
You can unlink the component and make changes as per your requirement (change the delimiter from ‘\n’ to ‘,’) or just copy the content of the component outside in the workbench and make the changes then create a new component.

Best,
Keerthan

1 Like

Hi @k10shetty1,

Thanks for the reply.

I think I am having a dumb moment because I understand the principle of what you are saying but not too sure how to execute this! Would you be able to explain further?

Thanks,
Beth

This is what I am currently feeding in to the sheet name variable…

And what it currently ends up with is this (i.e. creates the lines and pivot tabs for sample 1 then only the lines tab for the remaining samples with the wrong name)…

Hello Bethany_Duffy,

I am sorry for not explaining this clearly.

The component Create String Array Variable uses a cell splitter node. As per current settings within the component, it is splitting the strings which are separated by the next line character (‘\n’), since your data is separated by ‘,’ it is being treated as a single string (since there is no ‘\n’ character). So in the current settings, the array consists of a single element.

I hope the image below explains it in an easier way.

2023-09-04_15h16_24

2023-09-04_15h34_55

3 Likes

That is perfect - thank you so much!!

1 Like

Thanks @k10shetty1 :slight_smile: for assisting with the component!

I’ve just added a modified version where you can specify the delimiter :slight_smile:

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.