Filter .csv on import

  • Thread starter Thread starter b_lwalker
  • Start date Start date
B

b_lwalker

Hi,

I've created an import specification that will import a .csv file into
a table. It works just fine except that the program (our print
tracking software) that creates the .csv file will put the header
information in the first three rows, and the last three rows are
miscellaneous information too.

This generates an error tabble on import, even though the data I want
imports fine.

What I want to do is 'catch' the data on import, filter out the
useless stuff, then transfer it into the table.

Any ideas on how to do this in VB (or via a query)?
 
There's a couple of approaches here.

One is to massage the file before import. If the import is rare, you might
do this by opening the csv in Notepad, and removing the offending lines
before import.

If importing is common, you could do that in VBA code. Open the file for
input, and another for output. Input each line, and Print the lines you want
to the output file. Then TransferText on the real file.

That's probably easier than importing it into a big flat table where all
fields are Text 255 with no validation, and then using an Append query to
write the valid records to your real table.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top