Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 65
Default Reading a CSV file into an Excel w/b

I'm guessing, from the posts I've seen, that the following code will
open and read the contents of a CSV file:

Sub read_file()
Dim strTemp As String
Dim arline As Variant

Open "c:\temp\myfile.csv" For Input As #1
Do While Not EOF(1)
Line Input #1, strTemp
arline = Split(strTemp, ",", -1, vbTextCompare)
Loop
Close #1
End Sub

What I would like to know is, how do I get the data that is read from
the CSV, into my Excel w/b?

I have a number of CSV files that I am sent monthly, which need to be
placed into a master w/b. Some data manipulation needs to be
performed on the read data, e.g. dates appear in the format
'yyyymmddhhmmss' and need to be converted to 'dd/mm/yyyy hh:mm:ss'.
So, I guess my question is two-fold:

1. How do I get the data read in, and into the spreadsheet?
2. When do I perform the data manipulation and then get it into the
appropriate cells in the spreadsheet?

Many thanks for your help

Duncs
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Reading a CSV file into an Excel w/b

Hi Duncs

I'm actually working on a similar project. From what I know, there is no
need for special importing in order to open a csv file into Excel. I simply
double-click the csv file in Wondows explorer and Excel opens it like any
..xls file. Then I manipulate the data like usual, with Excel functions. I'm
sure there are limitations but you should be able to do your date changes.

"Duncs" wrote:

I'm guessing, from the posts I've seen, that the following code will
open and read the contents of a CSV file:

Sub read_file()
Dim strTemp As String
Dim arline As Variant

Open "c:\temp\myfile.csv" For Input As #1
Do While Not EOF(1)
Line Input #1, strTemp
arline = Split(strTemp, ",", -1, vbTextCompare)
Loop
Close #1
End Sub

What I would like to know is, how do I get the data that is read from
the CSV, into my Excel w/b?

I have a number of CSV files that I am sent monthly, which need to be
placed into a master w/b. Some data manipulation needs to be
performed on the read data, e.g. dates appear in the format
'yyyymmddhhmmss' and need to be converted to 'dd/mm/yyyy hh:mm:ss'.
So, I guess my question is two-fold:

1. How do I get the data read in, and into the spreadsheet?
2. When do I perform the data manipulation and then get it into the
appropriate cells in the spreadsheet?

Many thanks for your help

Duncs

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
Reading Excel File in VC++ raghav[_2_] Excel Programming 0 September 26th 06 12:04 PM
reading txt file and copying the lines in new excel file [email protected] Excel Programming 2 August 11th 06 07:20 PM
macro reading excel file HJP84 Excel Programming 1 June 6th 06 09:00 PM
reading from text file to excel file dgoel Excel Programming 0 April 18th 05 06:49 PM
Reading CSV file from Excel (VBA) Alex[_28_] Excel Programming 2 April 7th 05 03:10 AM


All times are GMT +1. The time now is 09:38 PM.

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"