Link to home
Start Free TrialLog in
Avatar of cmatchett
cmatchettFlag for United Kingdom of Great Britain and Northern Ireland

asked on

import csv to excel macro

Hi,

I have a csv file that has been exported from a storage controller and the format is like this.  

line1
line2
line3
line4
line5
date, item1
value, value
value, value
line7
line8
line9
line10
line11
date, item2
value, value
value, value
value, value
value, value

I would like to read the data after line 5 and 11 into a excel spreadsheet.  Can it be done using a macro ?

so the fields i would have would be

date, item1, date, item2
Avatar of gplana
gplana
Flag of Spain image

Why don't just edit the .csv on a text editor (like notepad) and remove these lines?
Then you can import the .csv as a text file, selecting the comma as the separator character.

Hope it helps.
Avatar of cmatchett

ASKER

The data would go into the spreadsheet in two continuous columns then?

I would like 4 columns

date, item1, date, item2
No, data will go on different rows.

However, once you have the pairs on different rows, you can manipulate the worksheet to combine two rows in one row.
Just import the whole file into one sheet and just extract the data you want into another using standard Excel cross sheet referencing.
ASKER CERTIFIED SOLUTION
Avatar of cmatchett
cmatchett
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
excel didn't get me the result i wanted