Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
johnlloyd45
Contributor
Contributor

Import Multiple CSV Files?

Hi, I'm completely new to Qlik Sense and am really struggling with working out how to import multiple data files.

My data sets are very simple in that they are two column CSV files with the first column containing the Timestamp and the second column a list of values. Unfortunately all of my data is in separate CSV's so I can have many different files, none of which have headings on the columns; the only unique identifiers are the filenames.

I am able to manually import these files one at a time, type in field-heading names (Timestep for column 1, whatever the filename is for column 2) and associate the files. But this is very time consuming and I'm sure there is a way to script this process.

Can anyone help me out with this?

Thanks!

12 Replies
Anonymous
Not applicable

Sorry! Since you aliased  @2, it make sense to use the new name in Unqualified:

Unqualify Value; 

johnlloyd45
Contributor
Contributor
Author

Yeah, I'd realised that and tried both the @1 and Timestep references in Unqualified. Sorry, I uploaded the wrong version of the script. Below is what I was actually using.

This gives the same issues as I described in that it won't let me Synchronise Scripted Tables so I cannot see the data in the Data Manager and no longer recognises the timestamp as a date field so I cannot use the Calendar Measures.

SET ThousandSep=',';
SET DecimalSep='.';
SET MoneyThousandSep=',';
SET MoneyDecimalSep='.';
SET MoneyFormat='£#,##0.00;-£#,##0.00';
SET TimeFormat='hh:mm:ss';
SET DateFormat='DD MMMM YYYY';
SET TimestampFormat='DD MMMM YYYY hh:mm:ss[.fff]';
SET FirstWeekDay=0;
SET BrokenWeeks=0;
SET ReferenceDay=4;
SET FirstMonthOfYear=1;
SET CollationLocale='en-GB';
SET CreateSearchIndexOnReload=1;
SET MonthNames='Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sep;Oct;Nov;Dec';
SET LongMonthNames='January;February;March;April;May;June;July;August;September;October;November;December';
SET DayNames='Mon;Tue;Wed;Thu;Fri;Sat;Sun';
SET LongDayNames='Monday;Tuesday;Wednesday;Thursday;Friday;Saturday;Sunday';

Qualify *;
Unqualify Timestep;

LOAD
    @1 AS Timestep,
    @2 AS Value
FROM [lib://RD Test Files/*.csv]
(txt, codepage is 1252, no labels, delimiter is '\t', msq);

Gysbert_Wassenaar

Try adding a line with Unqualify * after the loading of the csv files to restore the normal way of naming fields so only the tables generated from the csv files get prefixed field names.

Qualify *;
Unqualify Timestep;

LOAD
    @1 AS Timestep,
    @2 AS Value
FROM [lib://RD Test Files/*.csv]
(txt, codepage is 1252, no labels, delimiter is '\t', msq);

Unqualify *;


talk is cheap, supply exceeds demand