1.

Solve : Creating Excel files.?

Answer»

How to create excel files in folder with the same name of files that contains in that folder using batch?
explain more, you want to create a directory full of excel files that use the filenames of files in another directory just excel file type?? or do you want to rename all the files in a directory to excel file type?I have folder, in that folder there are *.txt files with date stamp in file name(exa today's date file name is 211208.txt) everyday new file with that days date will create.
I want to create only blank excel files with the same file names with extension *.txt extension present in that folder.Blank excel files with .txt extention ? or you want all the txt files to copy then be RENAMED to an excel extention? i DONT use excel but unless its in text chances are just adding an extention to a file isnt going to work..

@ECHO OFF
set dr=%systemdrive%\yourfolderpath&CLS
for /f "tokens=1*" %%a in ('dir /a %dr% /b') do (
call copy "%dr%\%%a%%b"
rename * *.EXL
)


Yourfolder path, dont ADD the C:\ part thats what %systemdrive% is for
*.EXL , is the excel file type i dont know what it is..
Hi,

It is working, but in this we are rename the file name from *.txt to *.xls.
But I don't want to rename file. I want to save file with the same name only with *.xls extension. I need *.txt file also.You'll need to use Excel to create an Excel spreadsheet. XLS files have a proprietary format that batch CODE cannot create:

Code: [Select]Const F_FOLDER = "c:\temp"

Set fso = CreateObject("Scripting.FileSystemObject")
Set xlApp = CreateObject("Excel.Application")

Set f = fso.GetFolder(F_FOLDER)
Set fc = f.Files

For Each fs In fc
If LCase(fso.GetExtensionName(fs)) = "txt" Then
Set xlBook = xlApp.Workbooks.Add()
Set xlSheet = xlBook.Worksheets(1)
xlBook.SaveAs F_FOLDER & "\" & fso.GetBaseName(fs) & ".xls"
End If
Next

xlApp.Quit

Note: change the value of F_FOLDER in the first line to a valid folder. Save the script with a vbs extension and run from the command line as cscript scriptname.vbs

An"empty" XLS file has 13K worth of control codes. Hi,
It is working.. Thanks.

Is there any way to copy data from 2 other files in excel file.

I have 2 files, one file contains only header & second file contains all data.
I want to combine this header & data in excel file.

Is it possible using Batch file?, because I want to do this with single click.

(In header file headers are in columns
exa.
header 1
header 2
header 3 etc.

I want this header to copy in first row of excel as
header 1 in row1, column A
header 2 in row1, column B
header 3 in row1, column C etc & then all data from second file & copy in excel from second row)

Is it possible by using batch file??
Quote

Is it possible by using batch file?

Sure, provided you use the batch file to launch the VBScripts.

It's unclear about the header and data files. Are they text files?

You want the headers laid out in the same row, different columns. You want the data laid out in a single column starting in row 2. Is this correct?



Hi,

The Header & Data (*.HDR & *.txt) both files are text files. Header file contains only headers of the data & data file contains all Data of that headers in individual columns.
I want to copy that data from *.txt file & paste it below respective header i.e. from second row.

Is it possible using batch file??

One more when headers are paste in Excel, is it possible that it should paste from second column i.e. from Column 'B' & then in First Column i.e. Column 'A', I want to write 'Date' & in second column i.e. Column 'B', 'Time'. As it is not include in header file but in data file date & time both are available.

Is it Possible?


Discussion

No Comment Found