Create new worksheet name for every data table row


I’m trying to create new excel worksheets for each row in my datatable.

The datatable contains 5 rows with different customer numbers in the first column i.e.:

CusNumber | fname | lName
123 | John | Smith
456 | Jane | Doe

Is there a way to capture the first customer number & create a new excel worksheet called i.e. 123, then the second worksheet name 456, etc all within the same workbook?

I’ve tried a 'for each row in DT > write range however, i just receive an error advising that the range doesn’t exist.

Any ideas?

This is one way to achieve since CusNumber is unique

Thanks @vvaidya for your quick solution however, i’m receiving the following error when I try to run it:

Write Range : Syntax error: Missing operand after ‘123’ operator.

Any ideas?

Can you share the screenshot of that part of your code?


error msg

This section falls with an Excel to scope activity, so i just used the shorter write cell activity.

The error received is:


Looks good to me. Try removing quotes

dt.Select("[cusNumber"] ="+row(0).ToString).CopyToDataTable


Thank you!