Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
Adamo
Contributor III
Contributor III

Load last modified CSV from Google Drive

Hi,

I am using Qlik Sense Business ( Qlik Server).

I have several .csv files in Google Drive and need just to load the LAST LOADED or MODIFIED file in Google Drive.

I am tryed to do the following but I am getting an error.

ERROR

Cannot open file: 'lib://Google_Drive - luisccmm@gmail.com/1LEHzEv6dSDSWXWPtcHn5c2_XSDVWMDsA7/*' (Connector error: Error getting file list: { "error": { "errors": [ { "domain": "global", "reason": "invalidParameter", "message": "Invalid field selection id", "locationType": "parameter", "location": "fields" } ], "code": 400, "message": "Invalid field selection id" } } ,)

 

 

 

LIB CONNECT TO 'Google_Drive - luisccmm@gmail.com';

SalesFolder:   //Here Your getting all the file names that are present in the source folder//

LOAD
    // RecNo() AS Records,
    FILENAME() AS KEY
FROM [lib://Google_Drive - luisccmm@gmail.com/1LEHzEv6dSDSWXWPtcHn5c2_XSDVWMDsA7/*.CSV]
(txt, utf8, embedded labels, delimiter is ',', msq);

MAX_FILE:  // Using resident your loading only the file that has minimum Timestamp//

LOAD

Minstring(KEY)  AS MAX_FILE

RESIDENT SalesFolder;

LET vMaxFile=peek('MAX_FILE','-1','MAX_FILE');  // Storing that (maxfile/min File) in a variable//

DROP TABLE SalesFolder;

SalesFolderWithMaxDate: // loading only the file that has max timestamp from the source folder//

lOAD 

  ClientID,
    BillingID,
    SalesmanID,
    Salesman,
    OrderID,
    ServiceID,
    Service,
    SalesDate,
    OrderDate,
    InstallDate,
    ChurnDate,
    DisconnectDate,
    NullDate,
    ZipCode,
    Network,
    BuildingID,
    PisoPortaID,
    Address,
    Escalera,
    Piso,
    Porta,
    OldServiceID,
    OldService,
    "Type",
    Campaign,
    AddressActivationDate,
    OrderedThrough,
    estado_finca,
    churn_reason,
    cancel_reason,
    InterestID

FROM

[lib://Google_Drive - luisccmm@gmail.com/1LEHzEv6dSDSWXWPtcHn5c2_XSDVWMDsA7/$(vMaxFile)]

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

 

 

 

 
Labels (2)
0 Replies