Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 7
Default how do I concatenate multiple CSV files into one?

I have a bunch of single line CSV files (without even new line characters on
the end) that I want to concatenate into a single file, which I then want to
work with in excel.

How can I do this?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,441
Default how do I concatenate multiple CSV files into one?

Robin,

Put the code below into an otherwise blank workbook, then run the macro, and select the files that
you want to combine when the file selection dialog appears.

HTH,
Bernie
MS Excel MVP


Sub ConsolidateMultipleUserSelectedFiles()
Dim FileArray As Variant
Dim myBook As Workbook
Set myBook = ThisWorkbook

FileArray = Application.GetOpenFilename(MultiSelect:=True)
If IsArray(FileArray) Then
For i = LBound(FileArray) To UBound(FileArray)
Workbooks.OpenText Filename:=FileArray(i), Origin:= _
xlWindows, StartRow:=1, DataType:=xlDelimited, TextQualifier:= _
xlDoubleQuote, ConsecutiveDelimiter:=True, Tab:=True, Semicolon:=False, _
Comma:=True, Space:=False, Other:=False, FieldInfo:=Array(1, 1)
Range("A1").CurrentRegion.Copy myBook.Worksheets(1).Range("a65536").End(xlUp).Off set(1, 0)
ActiveWorkbook.Close False
Next i
End If

myBook.Save
End Sub


"RobinC" wrote in message
...
I have a bunch of single line CSV files (without even new line characters on
the end) that I want to concatenate into a single file, which I then want to
work with in excel.

How can I do this?



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,123
Default how do I concatenate multiple CSV files into one?

Hi RobinC

You can do it also without code if you want
http://www.rondebruin.nl/csv.htm

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"RobinC" wrote in message ...
I have a bunch of single line CSV files (without even new line characters on
the end) that I want to concatenate into a single file, which I then want to
work with in excel.

How can I do this?

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,651
Default how do I concatenate multiple CSV files into one?

Will the method outlined in Example 1 deal with putting each line onto a new
row (which is what I *guessed* the OP may have wanted)?
--
David Biddulph

"Ron de Bruin" wrote in message
...
Hi RobinC

You can do it also without code if you want
http://www.rondebruin.nl/csv.htm

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"RobinC" wrote in message
...
I have a bunch of single line CSV files (without even new line characters
on the end) that I want to concatenate into a single file, which I then
want to work with in excel.

How can I do this?



  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,123
Default how do I concatenate multiple CSV files into one?

Yes if the data is one row in every csv file it is one row in Excel when you import the txt file

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"David Biddulph" <groups [at] biddulph.org.uk wrote in message ...
Will the method outlined in Example 1 deal with putting each line onto a new
row (which is what I *guessed* the OP may have wanted)?
--
David Biddulph

"Ron de Bruin" wrote in message
...
Hi RobinC

You can do it also without code if you want
http://www.rondebruin.nl/csv.htm

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"RobinC" wrote in message
...
I have a bunch of single line CSV files (without even new line characters
on the end) that I want to concatenate into a single file, which I then
want to work with in excel.

How can I do this?





  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default how do I concatenate multiple CSV files into one?

Just a curiousity question...

If you open a single CSV file, do things get imported correctly.

That lack of linefeed characters scares me.


RobinC wrote:

I have a bunch of single line CSV files (without even new line characters on
the end) that I want to concatenate into a single file, which I then want to
work with in excel.

How can I do this?


--

Dave Peterson
  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,651
Default how do I concatenate multiple CSV files into one?

Interesting!

When I tried it, the resulting file had no new line between the input csv
files, and didn't even have a comma or anything, so the first field of the
second file was concatenated with the last field of the first file, and so
on, and when imported into Excel they were all on the same row..

I wonder what I'm doing different from your suggestion?
--
David Biddulph

"Ron de Bruin" wrote in message
...
Yes if the data is one row in every csv file it is one row in Excel when
you import the txt file

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"David Biddulph" <groups [at] biddulph.org.uk wrote in message
...
Will the method outlined in Example 1 deal with putting each line onto a
new row (which is what I *guessed* the OP may have wanted)?
--
David Biddulph

"Ron de Bruin" wrote in message
...
Hi RobinC

You can do it also without code if you want
http://www.rondebruin.nl/csv.htm

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"RobinC" wrote in message
...
I have a bunch of single line CSV files (without even new line
characters on the end) that I want to concatenate into a single file,
which I then want to work with in excel.

How can I do this?



  #8   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,123
Default how do I concatenate multiple CSV files into one?

Hi David

No problem here with a new test when I use the exact steps from my site
I go to bed now but maybe Dave or ? can help you

If not I reply tomorrow after work


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"David Biddulph" <groups [at] biddulph.org.uk wrote in message ...
Interesting!

When I tried it, the resulting file had no new line between the input csv
files, and didn't even have a comma or anything, so the first field of the
second file was concatenated with the last field of the first file, and so
on, and when imported into Excel they were all on the same row..

I wonder what I'm doing different from your suggestion?
--
David Biddulph

"Ron de Bruin" wrote in message
...
Yes if the data is one row in every csv file it is one row in Excel when
you import the txt file

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"David Biddulph" <groups [at] biddulph.org.uk wrote in message
...
Will the method outlined in Example 1 deal with putting each line onto a
new row (which is what I *guessed* the OP may have wanted)?
--
David Biddulph

"Ron de Bruin" wrote in message
...
Hi RobinC

You can do it also without code if you want
http://www.rondebruin.nl/csv.htm

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"RobinC" wrote in message
...
I have a bunch of single line CSV files (without even new line
characters on the end) that I want to concatenate into a single file,
which I then want to work with in excel.

How can I do this?


  #9   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default how do I concatenate multiple CSV files into one?

I really think it depends on what this means:
"(without even new line characters on the end)"

I'm not sure if that means that there is no linefeed, no carriage return or
what.

I do remember having to convert text files that came from a UNIX system so that
each line had the DOS CRLF at the end of each line instead of just the UNIX LF
characters.




Ron de Bruin wrote:

Hi David

No problem here with a new test when I use the exact steps from my site
I go to bed now but maybe Dave or ? can help you

If not I reply tomorrow after work

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm

"David Biddulph" <groups [at] biddulph.org.uk wrote in message ...
Interesting!

When I tried it, the resulting file had no new line between the input csv
files, and didn't even have a comma or anything, so the first field of the
second file was concatenated with the last field of the first file, and so
on, and when imported into Excel they were all on the same row..

I wonder what I'm doing different from your suggestion?
--
David Biddulph

"Ron de Bruin" wrote in message
...
Yes if the data is one row in every csv file it is one row in Excel when
you import the txt file

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"David Biddulph" <groups [at] biddulph.org.uk wrote in message
...
Will the method outlined in Example 1 deal with putting each line onto a
new row (which is what I *guessed* the OP may have wanted)?
--
David Biddulph

"Ron de Bruin" wrote in message
...
Hi RobinC

You can do it also without code if you want
http://www.rondebruin.nl/csv.htm

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"RobinC" wrote in message
...
I have a bunch of single line CSV files (without even new line
characters on the end) that I want to concatenate into a single file,
which I then want to work with in excel.

How can I do this?



--

Dave Peterson
  #10   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,651
Default how do I concatenate multiple CSV files into one?

In my test file I had no CR, LF, trailing comma, or any other delimiter
after the last character of the data. That was my interpretation of
"(without even new line characters on the end)".
--
David Biddulph

"Dave Peterson" wrote in message
...
I really think it depends on what this means:
"(without even new line characters on the end)"

I'm not sure if that means that there is no linefeed, no carriage return
or
what.

I do remember having to convert text files that came from a UNIX system so
that
each line had the DOS CRLF at the end of each line instead of just the
UNIX LF
characters.




Ron de Bruin wrote:

Hi David

No problem here with a new test when I use the exact steps from my site
I go to bed now but maybe Dave or ? can help you

If not I reply tomorrow after work

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm

"David Biddulph" <groups [at] biddulph.org.uk wrote in message
...
Interesting!

When I tried it, the resulting file had no new line between the input
csv
files, and didn't even have a comma or anything, so the first field of
the
second file was concatenated with the last field of the first file, and
so
on, and when imported into Excel they were all on the same row..

I wonder what I'm doing different from your suggestion?
--
David Biddulph

"Ron de Bruin" wrote in message
...
Yes if the data is one row in every csv file it is one row in Excel
when
you import the txt file

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"David Biddulph" <groups [at] biddulph.org.uk wrote in message
...
Will the method outlined in Example 1 deal with putting each line
onto a
new row (which is what I *guessed* the OP may have wanted)?
--
David Biddulph

"Ron de Bruin" wrote in message
...
Hi RobinC

You can do it also without code if you want
http://www.rondebruin.nl/csv.htm

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"RobinC" wrote in message
...
I have a bunch of single line CSV files (without even new line
characters on the end) that I want to concatenate into a single
file,
which I then want to work with in excel.

How can I do this?



--

Dave Peterson





  #11   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default how do I concatenate multiple CSV files into one?

That matches up with my results, too.

I'd add those CRLF characters at the end of each line -- either in each file or
in the way I'd concatenate them.

David Biddulph wrote:

In my test file I had no CR, LF, trailing comma, or any other delimiter
after the last character of the data. That was my interpretation of
"(without even new line characters on the end)".
--
David Biddulph

"Dave Peterson" wrote in message
...
I really think it depends on what this means:
"(without even new line characters on the end)"

I'm not sure if that means that there is no linefeed, no carriage return
or
what.

I do remember having to convert text files that came from a UNIX system so
that
each line had the DOS CRLF at the end of each line instead of just the
UNIX LF
characters.




Ron de Bruin wrote:

Hi David

No problem here with a new test when I use the exact steps from my site
I go to bed now but maybe Dave or ? can help you

If not I reply tomorrow after work

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm

"David Biddulph" <groups [at] biddulph.org.uk wrote in message
...
Interesting!

When I tried it, the resulting file had no new line between the input
csv
files, and didn't even have a comma or anything, so the first field of
the
second file was concatenated with the last field of the first file, and
so
on, and when imported into Excel they were all on the same row..

I wonder what I'm doing different from your suggestion?
--
David Biddulph

"Ron de Bruin" wrote in message
...
Yes if the data is one row in every csv file it is one row in Excel
when
you import the txt file

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"David Biddulph" <groups [at] biddulph.org.uk wrote in message
...
Will the method outlined in Example 1 deal with putting each line
onto a
new row (which is what I *guessed* the OP may have wanted)?
--
David Biddulph

"Ron de Bruin" wrote in message
...
Hi RobinC

You can do it also without code if you want
http://www.rondebruin.nl/csv.htm

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"RobinC" wrote in message
...
I have a bunch of single line CSV files (without even new line
characters on the end) that I want to concatenate into a single
file,
which I then want to work with in excel.

How can I do this?



--

Dave Peterson


--

Dave Peterson
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
vlookup and concatenate multiple occurences jlclyde Excel Discussion (Misc queries) 0 June 17th 08 06:55 PM
view multiple files in multiple windows on multiple screens. tcom Excel Discussion (Misc queries) 7 September 15th 05 09:35 PM
Concatenate Multiple Cells Sonya795 Excel Discussion (Misc queries) 4 August 22nd 05 08:51 PM
Concatenate multiple cells moglione1 Excel Discussion (Misc queries) 5 August 19th 05 05:38 PM
How can I view files chronologically when opening multiple files Stevilsize Excel Discussion (Misc queries) 3 July 26th 05 12:49 AM


All times are GMT +1. The time now is 10:33 PM.

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

About Us

"It's about Microsoft Excel"