Jump to content

Find a number in txt or xls file


Recommended Posts

Hello, excuse my bad english i'm french.

i have a list with my client number and an ID associate to this client.

N° client          ID
 NUMER000575       65657cf30c8gdsgfdgfd88b4588
 NUMER000576       65657d14dsgfsgfsgssdfdsf4595
 NUMER004218       6565af2b948b09afe58b45e6dsf
 NUMER270575       6565bdcd94fef998228b456bff

at the start, my script recover the number of my client in an other file.

Example i want find the 575 in my column "N° client" and copy the ID in front of.

But the 575 is also in the 270575 (last line) 

Is it possible ? 

 

Second question, my list is on a txt file or in a XLS file 

Is it possible to read in the XLS file without Excel installated ?

 

thanks.

 

 

 

 

Link to comment
Share on other sites

$txt = FileRead("1.txt")
$n = "575"
$id = StringRegExpReplace($txt, '(?s).*\s*NUMER0*' & $n & '\s*(\w+).*', "$1")
If @extended Then Msgbox(0,"", $id)

You can read your file if in txt format using FileReadToArray

BTW please avoid double posts (both French and English forums)  ;)

thanks, but when i try the script it doesn't work.

What is the use of "@extended ?

 

Link to comment
Share on other sites

In your text from post #1 I saw this

NUMER270575       6565bdcd94fef998228b456bff

So I assumed that the 'N°client' was composed of NUMER + 6 digits
If it should be NUMERO + digits you just have to insert the 'O' (letter) after NUMER in the expression  :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...