0

This works:-

for /F  "tokens=4 delims=    skip=1" %%x in (myfile.txt) DO echo %%x

But not this:-

for /F  "tokens=4 delims=    skip=1" %%x in (myfile.xls) DO echo %%x

How can i read xls without converting to tab saperated?

XLS = Excel file

1
  • The title of your question is wrong... are you talking about XML or XLS? Commented Nov 23, 2009 at 6:49

3 Answers 3

1

if you want to do it with batch, for whatever reasons, you can export and save your xls file to comma separated (csv), then use delim=, in your batch for loop.

Sign up to request clarification or add additional context in comments.

Comments

0

Whether you're talking about the binary .xls format or XML, parsing in a Windows batch file is basically going to be impractical. You should use a more appropriate tool. The closest thing to a Windows batch file which will be able to cope with this is probably PowerShell.

Batch files are okay for pretty simple tasks, but when you need to do anything with a bit more complexity, you should look to use something more powerful. (I'm not particularly fond of Windows batch files in the first place compared with, say, bash scripts - but sometimes they're the easiest way to get things done.)

Comments

0

If you have Excel installed, you can easily create a vbscript or PowerShell script for the task. The Windows command shell interpreter really isn't up to the task of parsing Excel files.

VBScript:

Set objExcel = CreateObject("Excel.Application")

PowerShell:

a = New-Object -comobject Excel.Application

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.