Hi,
I have a question. Is it possible to convert a .xls-file and a .csv-file into a tab-delimited .txt-file with a batch-file. If so, how can this be done?
Thanks in advance.
Bram.
Convert .xls and .csv to tab-delimited .txt
Moderator: DosItHelp
-
- Posts: 1
- Joined: 23 Apr 2009 02:12
Re: Convert .xls and .csv to tab-delimited .txt
I hate to bump an older thread, but is there an answer to this? I'm wondering the exact same thing.
Re: Convert .xls and .csv to tab-delimited .txt
Not with batch.
Working with excel files requires Excel to be installed. Vbscript and Powershell are the only scripting languages that I know of that can use excel as an object to do this.
Working with excel files requires Excel to be installed. Vbscript and Powershell are the only scripting languages that I know of that can use excel as an object to do this.
-
- Expert
- Posts: 1166
- Joined: 06 Sep 2013 21:28
- Location: Virginia, United States
Re: Convert .xls and .csv to tab-delimited .txt
You can't edit .xls files, but .csv files are just text files where values are separated by commas, so you can use something like findrepl.bat to just replace all of the commas with tabs.
On a related note, you can edit .xlsx files since they're just an archive of .xml files, but the whole thing is so ludicrously complicated and interconnected that it's really not a good idea to do so.
On a related note, you can edit .xlsx files since they're just an archive of .xml files, but the whole thing is so ludicrously complicated and interconnected that it's really not a good idea to do so.
Re: Convert .xls and .csv to tab-delimited .txt
ShadowThief wrote:... but .csv files are just text files where values are separated by commas, so you can use something like findrepl.bat to just replace all of the commas with tabs.
Potentially it is not that simple because CSV allows both comma and newlines literals within values if they are quoted. And quote literals within a quoted value are escaped as two quotes.
Dave Benham
-
- Expert
- Posts: 1166
- Joined: 06 Sep 2013 21:28
- Location: Virginia, United States
Re: Convert .xls and .csv to tab-delimited .txt
dbenham wrote:ShadowThief wrote:... but .csv files are just text files where values are separated by commas, so you can use something like findrepl.bat to just replace all of the commas with tabs.
Potentially it is not that simple because CSV allows both comma and newlines literals within values if they are quoted. And quote literals within a quoted value are escaped as two quotes.
Dave Benham
You could first delimit by double quotes and then only convert the commas in the odd-numbered tokens
Re: Convert .xls and .csv to tab-delimited .txt
Hybrid batch/jscript:
viewtopic.php?f=3&t=4628&p=33475#p33475
Last post
XLS2CSV "D:\XLpath\my file.xlsx" "D:\CSVfiles\my file.csv" /S=/t
Converts xlsx to tab delimited txt file. I don't think there is a pure batch solution.
viewtopic.php?f=3&t=4628&p=33475#p33475
Last post
XLS2CSV "D:\XLpath\my file.xlsx" "D:\CSVfiles\my file.csv" /S=/t
Converts xlsx to tab delimited txt file. I don't think there is a pure batch solution.