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-------------- ---------- ---------- ---Blanket s
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
Laundry table-fields csv file-fields
Date----------------------
blktdescript--------------
blktamtin-----------------
shtpdescript--------------
shtpamtin-----------------
shtbtdescript-------------
shtbtamtin----------------
sprddescript--------------
sprdamtin-----------------
Btdescript----------------
Btamtin-------------------
Bstdescript---------------
Bstamtin------------------
Pcdescript----------------
pcamtin-------------------
Wcdescript----------------
wcamtin-------------------
Oth21descript-------------
oth21amtin----------------
1-2014-5-1-8-1.csv
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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,
,,
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
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.
Thanks
Rob H