Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Append from
Message
From
28/08/2023 18:12:43
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
01687001
Message ID:
01687002
Views:
51
>Hello friends; How can I skip the header of a txt file when doing APPEND FROM?

Some options:

- Change the process that creates the text file to exclude the header row. For example, if it's an Excel CSV, you could Google [excel export to csv without header]
- If the APPEND FROM is working without error but you get a "junk" row at the top, in the target table you could:
GO TOP
DELETE NEXT 1
PACK
- You could create a copy of the original text file, but with the header trimmed out, and APPEND FROM that. Pseudocode:
* Import the original text file to a string with FILETOSTR( )
* Use AT( ) to determine the length of the first text line - find the location of Carriage Return/Line Feed (CRLF) combination i.e. CHR( 13 ) + CHR( 10 )
* Use STRTOFILE( ) to write out the RIGHT( String, LEN( String ) - LEN ( FirstLine) ) portion of the string to a new text file
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Previous
Reply
Map
View

Click here to load this message in the networking platform