Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Importing CSV file that may have 0 records

I'm trying to import a CSV file that will sometimes have records and sometimes will be empty (other than the field names in the first line), however, I get a scripting error (field not found) if it does have 0 records.  Any way around this issue?

3 Replies
el_aprendiz111
Specialist
Specialist

Hi,

Directory;

LOAD @1 AS FIELD,

    @2 AS FIELD1,

     @3 AS FIEL2,

     @4 AS FIELD3,

     @5 AS FIELD4,

     @6 AS FIELD5

    

FROM

[..\miRpt.csv]

(txt, utf8, no labels, delimiter is ',', msq);

MarcoWedel

can you post a sample csv and your failing load statement?

thanks

regards

Marco

Anonymous
Not applicable
Author

In the process of attaching it --- I realized what the problem is.  For some reason even though it works just fine when it creates a filewith records, when it creates a file without records the field names are space delimited, not comma delimited, so they all get strung together as the name for the first field. 

Sorry about wasting people's time.