Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Uploading Data from Excel
Message
De
23/01/2021 16:12:03
 
 
À
18/01/2021 18:01:05
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01677823
Message ID:
01677903
Vues:
97
Thanks Michael et al,

Yeah, in the past i do recall importing data into a temporary dbf, and running validation against it before even importing it into the table. It was medical data so I even added probably and unnecessary level of validation on the import process that was conducted line by line before that data was imported into the live data table also.

I reckon it was kinda wishful thinking to help cut down on the import process. The data file that the user uses this time is daily. Could come from several sources.

>Howdy all,
>I have an excel spreadsheet that user wants uploaded into a table. The spreadsheet has one or two headers that are column headers only. After the first two lines, is when the actual data/content begins. What's teh best way to upload data using vfp 9.0 or XML to ensure that I do not capture those column headers? ?

If they want a repeat import, be careful to tell them that human-created or human-edited spreadsheets WILL EVENTUALLY FAIL to import properly and will require human intervention (techie, meaning your intervention).

Spreadsheets that look the same to humans don't always look the same to your code.
Expect failure.
Expect a lot of failure.
We do a lot of spreadsheet imports, and we have learned the hard way to validate, validate, and then validate again.
Do column headings match what the code expects?
Does it have the same number of columns as expected?
Are necessary data elements missing?
Is the number of rows about what we should expect?

If it is a one-time import, just open it in Excel, edit as needed, and save as CSV in Excel.
The VFP import wizard will create a DBF for you from that CSV.
(Menu: Tools/Wizards/Import)

Always treat the data imported from Excel or CSV as a temp table.
Importing straight into a table that has real data will cause problems.
Always validate before accepting that new data.
My $.02 about lessons we learned the hard way :)

Wish I had some code to share, but most of our spreadsheet code is in C# or PHP and is not generic enough to share anyhow.

Good luck!
Michael
Thanks in Advance.

J. Turner
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform