Searching within EXCEL file and outputting answer

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
D007Nomad
Posts: 3
Joined: 27 Jan 2016 23:11

Searching within EXCEL file and outputting answer

#1 Post by D007Nomad » 28 Jan 2016 00:03

Hi Guys

New to the forum, and still quite new to scripting with batch files..

So please bare with me..


Right so, this is what i'm trying to do.

I Have an excel file with 2 Columns

CODE(Columns A) Number(Columns B)

C001 55513689
C002 55513684
C003 55554893


Basically, I want to write a batch, or anything else that could be better - to search for the code, and output the number.

So.. You put in there "C003" and it outputs "55554893"


Thank youuuuu all :mrgreen: :mrgreen: :mrgreen:

Squashman
Expert
Posts: 4486
Joined: 23 Dec 2011 13:59

Re: Searching within EXCEL file and outputting answer

#2 Post by Squashman » 28 Jan 2016 07:25

Batch files cannot read Excel files. You will need to look at using Vbscript or Jscript.

thefeduke
Posts: 211
Joined: 05 Apr 2015 13:06
Location: MA South Shore, USA

Re: Searching within EXCEL file and outputting answer

#3 Post by thefeduke » 28 Jan 2016 10:24

If you save the spreadsheet as a .csv comma-delimited file you can work with this in batch:

Code: Select all

"C001",55513689
"C002",55513684
"C003",55554893
John A

Matt Williamson
Posts: 82
Joined: 30 Dec 2013 10:16
Location: United States by the big waterfall

Re: Searching within EXCEL file and outputting answer

#4 Post by Matt Williamson » 28 Jan 2016 10:50

This is a job for VBA in excel. Post it up in the Excel VBA forum on Stackoverflow Excel VBA and you'll get an answer but be sure to actually try something first.

D007Nomad
Posts: 3
Joined: 27 Jan 2016 23:11

Re: Searching within EXCEL file and outputting answer

#5 Post by D007Nomad » 01 Feb 2016 01:11

Can anyone assist with a VBS then?

Squashman
Expert
Posts: 4486
Joined: 23 Dec 2011 13:59

Re: Searching within EXCEL file and outputting answer

#6 Post by Squashman » 01 Feb 2016 07:42

D007Nomad wrote:Can anyone assist with a VBS then?

No. That is out of scope of what this forum does. You were directed to post over on StackOverFlow.

Post Reply