Link to home
Get AccessLog in
Avatar of campbme
campbme

asked on

Import data from a csv file

I need to import data from a csv file to a Vfp table called Laundry.  In the csv file, there are three data fields(Date, Total Weight, Description) to import into the vfp table.  I have the csv file attached below.  What code can I use to import the csv data?

Laundry table-fields                                  csv file-fields

Date----------------------------------------------05/01/2014
blktdescript-------------------------------------Blankets
blktamtin----------------------------------------Total Weight
shtpdescript------------------------------------Flat Sheets
shtpamtin---------------------------------------Total Weight
shtbtdescript------------------------------------Fit Sheets
shtbtamtin--------------------------------------Total Weight
sprddescript------------------------------------Spreads
sprdamtin---------------------------------------Total Weight
Btdescript---------------------------------------Bath Towels
Btamtin------------------------------------------Total Weight
Bstdescript-------------------------------------Bea Shop Towels
Bstamtin----------------------------------------Total Weight
Pcdescript--------------------------------------Pillow Cases
pcamtin-----------------------------------------Total Weight
Wcdescript-------------------------------------Wash Cloths
wcamtin----------------------------------------Total Weight
Oth21descript---------------------------------Personal Garment
oth21amtin------------------------------------Total Weight
1-2014-5-1-8-1.csv
Avatar of Rob Henson
Rob Henson
Flag of United Kingdom of Great Britain and Northern Ireland image

The csv file uploaded doesn't really show a lot. A larger data set will be required.

Thanks
Rob H
ASKER CERTIFIED SOLUTION
Avatar of plusone3055
plusone3055
Flag of United States of America image

Link to home
membership
This content is only available to members.
To access this content, you must be a member of Experts Exchange.
Get Access
1. the file you uploaded is not a well-formed CSV format.  There are lines prior to the CSV (row/col) data.
5/1/2014,8:01:01,
Account Number:,1,
,,

Open in new window

2. The CSV data does not match expected values.  The Total Weight field contains all zero values.
three data fields(Date, Total Weight, Description)

ITEM #:,TOTAL WEIGHT,DESCRIPTION
1,0,BLANKETS
2,0,FLAT SHEETS
3,0,FIT SHEETS
4,0,SPREADS
5,0, BATH TOWELS
6,0,BEA SHOP TOWELS
7,0,PILLOW  CASES
8,0,WASH CLOTHS
9,0,PERSONAL GARMENT

Open in new window

And it is more complex than a simple import. You want to add the row values into different columns, that is create a pivot table.