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
Microsoft ExcelWindows OSSQL

Avatar of undefined
Last Comment
Qlemo

8/22/2022 - Mon
Rob Henson

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

Thanks
Rob H
ASKER CERTIFIED SOLUTION
plusone3055

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
aikimark

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

Qlemo

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.
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy