#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9,101
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,651
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9,101
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9,101
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9,101
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Scripting from command line [email protected] Excel Discussion (Misc queries) 0 January 24th 07 04:29 PM
Export from OL to Excel with 2 line addresses question Judy Excel Discussion (Misc queries) 0 December 11th 06 08:47 PM
is it possible to add data to cells from the command line? Martin Excel Discussion (Misc queries) 2 August 11th 06 01:27 PM
macros from command line Cyberwolf Excel Discussion (Misc queries) 3 July 19th 05 05:35 PM
Q: command line in OE JIM.H. Excel Discussion (Misc queries) 0 May 30th 05 10:48 PM


All times are GMT +1. The time now is 04:45 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"