Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Uploading Data from Excel
Message
From
18/01/2021 18:01:05
 
 
To
13/01/2021 08:43:23
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01677823
Message ID:
01677860
Views:
125
>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform