Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Command Line Export
I need to export a sheet to a file in a tab-separated format, to use in a bat
script. How do I do that ? Is it possible ? Are there any tools ? Regards Jurek |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Command Line Export
You can save a workbook with only one worksheet as a csv file by using the
File -Save As menu option and selectt .csv format. These are text files which can be read by other programs. "fjurek" wrote: I need to export a sheet to a file in a tab-separated format, to use in a bat script. How do I do that ? Is it possible ? Are there any tools ? Regards Jurek |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Command Line Export
The OP said he wanted TAB-separated, not COMMA-separated.
Joel is right in his answer as far as File/ Save As, but at that stage one of the .txt options is TAB-separated. -- David Biddulph "Joel" wrote in message ... You can save a workbook with only one worksheet as a csv file by using the File -Save As menu option and selectt .csv format. These are text files which can be read by other programs. "fjurek" wrote: I need to export a sheet to a file in a tab-separated format, to use in a bat script. How do I do that ? Is it possible ? Are there any tools ? Regards Jurek |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
Command Line Export
You can always replace tabs with spaces using notepad once the file is saved.
Hopefully there is not commas in the cell data. "David Biddulph" wrote: The OP said he wanted TAB-separated, not COMMA-separated. Joel is right in his answer as far as File/ Save As, but at that stage one of the .txt options is TAB-separated. -- David Biddulph "Joel" wrote in message ... You can save a workbook with only one worksheet as a csv file by using the File -Save As menu option and selectt .csv format. These are text files which can be read by other programs. "fjurek" wrote: I need to export a sheet to a file in a tab-separated format, to use in a bat script. How do I do that ? Is it possible ? Are there any tools ? Regards Jurek |
#5
Posted to microsoft.public.excel.misc
|
|||
|
|||
Command Line Export
There is also a Tab delimited text option in the SAve As choices.
"David Biddulph" wrote: The OP said he wanted TAB-separated, not COMMA-separated. Joel is right in his answer as far as File/ Save As, but at that stage one of the .txt options is TAB-separated. -- David Biddulph "Joel" wrote in message ... You can save a workbook with only one worksheet as a csv file by using the File -Save As menu option and selectt .csv format. These are text files which can be read by other programs. "fjurek" wrote: I need to export a sheet to a file in a tab-separated format, to use in a bat script. How do I do that ? Is it possible ? Are there any tools ? Regards Jurek |
#6
Posted to microsoft.public.excel.misc
|
|||
|
|||
Command Line Export
Thank you all.
This is all true, and I use it on single files, but I need to use it on many files and for other manipulations on these data, so I want to have it in a bat file, and the export should work from the command line or script. Yours Jurek "Joel" wrote: There is also a Tab delimited text option in the SAve As choices. "David Biddulph" wrote: The OP said he wanted TAB-separated, not COMMA-separated. Joel is right in his answer as far as File/ Save As, but at that stage one of the .txt options is TAB-separated. -- David Biddulph "Joel" wrote in message ... You can save a workbook with only one worksheet as a csv file by using the File -Save As menu option and selectt .csv format. These are text files which can be read by other programs. "fjurek" wrote: I need to export a sheet to a file in a tab-separated format, to use in a bat script. How do I do that ? Is it possible ? Are there any tools ? Regards Jurek |
#7
Posted to microsoft.public.excel.misc
|
|||
|
|||
Command Line Export
Thsi macro will automatically write TAB text
Sub WriteTab() Const ForReading = 1, ForWriting = 2, ForAppending = 3 Const MyPath = "C:\temp\" Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0 MyTAB = Chr(9) Set fswrite = CreateObject("Scripting.FileSystemObject") WriteFileName = "tabtext.txt" WritePathName = MyPath + WriteFileName fswrite.CreateTextFile WritePathName Set fwrite = fswrite.GetFile(WritePathName) Set tswrite = fwrite.OpenAsTextStream(ForWriting, TristateUseDefault) LastRow = Rows.Count Do While (Cells(LastRow, Columns.Count).End(xlToLeft).Column = 1) And _ IsEmpty(Cells(LastRow, 1)) LastRow = LastRow - 1 Loop For RowCount = 1 To LastRow LastColumn = Cells(RowCount, Columns.Count).End(xlToLeft).Column For ColCount = 1 To LastColumn If ColCount = 1 Then OutputLine = Cells(RowCount, ColCount) Else OutputLine = OutputLine + MyTAB + CStr(Cells(RowCount, ColCount)) End If Next ColCount tswrite.WriteLine OutputLine Next RowCount tswrite.Close End Sub "fjurek" wrote: Thank you all. This is all true, and I use it on single files, but I need to use it on many files and for other manipulations on these data, so I want to have it in a bat file, and the export should work from the command line or script. Yours Jurek "Joel" wrote: There is also a Tab delimited text option in the SAve As choices. "David Biddulph" wrote: The OP said he wanted TAB-separated, not COMMA-separated. Joel is right in his answer as far as File/ Save As, but at that stage one of the .txt options is TAB-separated. -- David Biddulph "Joel" wrote in message ... You can save a workbook with only one worksheet as a csv file by using the File -Save As menu option and selectt .csv format. These are text files which can be read by other programs. "fjurek" wrote: I need to export a sheet to a file in a tab-separated format, to use in a bat script. How do I do that ? Is it possible ? Are there any tools ? Regards Jurek |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Scripting from command line | Excel Discussion (Misc queries) | |||
Export from OL to Excel with 2 line addresses question | Excel Discussion (Misc queries) | |||
is it possible to add data to cells from the command line? | Excel Discussion (Misc queries) | |||
macros from command line | Excel Discussion (Misc queries) | |||
Q: command line in OE | Excel Discussion (Misc queries) |