How to I split the values of an Excel cell to multiple variables based on the character count?

Hello All,

How do I split the values of the column “Address” to multiple variables ?

image

First 30 characters should be assigned to one variable, next 30 to another and the remaining to another variable.

Kindly attach an XAML file for my better understanding.

Thank you.

@uio

can you refer this

Sequence.xaml (10.1 KB)

Hi @uio

Assign -> address= "No. 40A, 5th floor, DEF building, GHI street, JKLM."
Assign -> result= address.Split(","c).Select(Function(s) s.Trim()).ToArray()
Assign -> building= $"{result(0)}, {result(1)}, {result(2)}"
Assign -> street= result(3)
Assign -> city= $"{result(4)}"

Refer the xaml file for better understanding.
Sequence4.xaml (7.6 KB)

Hope it helps!!

The values are not fixed. That’s why I needed to split the values based on the character count.

Can you please attach the input file ?

Hi @uio
If possible can you attach sample input file with different scenarios so that we can sort it out.

Regards

@uio

New Microsoft Excel Worksheet.xlsx (8.9 KB)

“Sheet2”

InputFile.xlsx (9.4 KB)

@uio

can you share the expected output also so that we can help

I want to enter the values in the “Address” column in a web application.

There are three fields for entering the address.

  1. Street/House Number
  2. Street 4
    3.Street 5.

But these field accepts only limited number of characters.

I want to enter the 1st 30 characters of the Address in “Street/House Number” field, next 30 characters in “Street 4” field and the remaining in the “Street 5” field.

Hi @uio,

You can achieve this using a custom code inside Invoke Code activity. PFA the XAML for your understanding

SplitAddress.xaml (8.6 KB)

Cheers

1 Like

@uio
here in your given example if you take first 30 characters!
complete text cant extract
once check the below example…
give me more examples so that can check the pattern

image

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