Eliminate text from invoice number

Hello,

I need to remove the text from the invoice number- MAA4-1013406 and after removing i have to place the same in the invoice cell
![The image is a screenshot of an Excel spreadsheet displaying information including a billing address, GST registration number, place of supply, place of delivery, invoice number, invoice details, invoice date, and order number. (Captioned by AI)|690x42].
(upload://a4StnJeM9C5iZDndhkPv2z9OPUM.png)

How can i achieve this?

Please help

Hi, You missed to add the screenshot.
But you can apply a regex to get the Invoice #

-(\d+)$

In order to remove it: text.replace(/-(\d+)$/, β€˜β€™)

1 Like

Answer:
First (RegEx) Use a Assign Activity
InvoiceNumber = System.Text.RegularExpressions.Regex.Replace(OriginalInvoiceNumber, β€œ[^0-9]”, β€œβ€)

  1. Explanation:
  • OriginalInvoiceNumber: Variable holding the value MAA4-1013406.
  • The regex pattern [^0-9] removes everything except digits.

OR

string Manipulation
assign
InvoiceNumber = OriginalInvoiceNumber.Split("-"c)(1)

This splits the string at - and retrieves the second part (1013406).

Then
Use a Write Cell activity in the Excel scope to write the InvoiceNumber back into the same cell

i tried using regex… now i want to replace the existing value to the new varaiable
Sequence.xaml (12.3 KB)

This is the excel
Data.xlsx (9.5 KB)

Directly Update the Variable:

invoiceNumber = newInvoiceNumber

I did the same and achieved

1 Like

your issue resolved?