0

I have done quite a bit of searching before posting this question so let me outline what I am trying to do.

1.) I do not want to use applications I have to download from a website or created custom commands (please no start Xls2Csv.exe here's a link to a website where you can download the program) I do not want to download a program to do this.

2.) I want to keep it in the batch file if possible - I have tried the vbc/vbs/vb files that is not what I am looking for.

3.) I found this an this is close to what I need but if I can stay within a batch file that would be best: Can a Batch File Tell a program to save a file as? (If so how)

Background I have a bunch of test records stored in excel sheets within folders. Each test record has autoformatted name so the only real difference between any of the filenames is a serial number, otherwise each file name is formatted the exact same way.

I have written a batch file to search and find the files I need but I am stuck on obtaining a tiny bit of information in a .xls file.

  • What I am trying to do - I have excel files (.xls) and there is a word in a cell on one of many sheets that I would like to copy into a textfile. However I am unable to use findstr for an excel find because the command searches the file as if you opened it in notepad and the data I need is not present.

  • I am not concerned of data loss as long as I can get this tiny bit of information to a text file.

Otherwise what I have found to be the best solution is to convert an XLS to a CSV. I have manually done it by opening the file and saving as type .csv that worked.

What hasn't worked is:

example1.xls >> example2.csv

ren example1.xls example3.csv - this will save it as a csv file but still opens with the same formating of the xls file in both excel and notepad.

I was hoping that the was a command to recreate the manual process of opening the file and saving as csv.

If there are any other suggested solutions - maybe a command where I can search for a string within an excel file? That would be the simplest option.

Compo
  • 36,585
  • 5
  • 27
  • 39
  • 1
    Your question is looking for research information, or free code, and is not what this site is supposed to be for. Use PowerShell, which is capable of the task, and which there exists, already on this site, questions and answers similar to your own. Here we close duplicate questions, so I'd advise that you use the search facility at the top of the page and look for solutions using PowerShell. If the code you create from those results fails to work as intended, you can post the code you created as an [edit] to your modified question, together with a specific issue and the debugging information. – Compo Aug 06 '21 at 19:06
  • Or if you don't like Powershell for whatever reason, this is only a couple of lines in vbscript. https://devblogs.microsoft.com/scripting/how-can-i-save-a-single-excel-worksheet-to-a-csv-file/ – SomethingDark Aug 06 '21 at 19:21

0 Answers0