Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
madhumitha
Creator
Creator

Excel file name as Primary Key

Hello All,

I have few excel files from which I should be extracting the data.

The excel file name is in the below format.

Test dashboard PKC00002 Health Checks_31May17.xlsx

While extracting data from the file, how do I extract the primary key from the name of the file. In the above example, it would be "PKC0002"

Thanks in advance.

1 Solution

Accepted Solutions
Chanty4u
MVP
MVP

Hi

check below code

LOAD Product_Id,

     Product_Line,

     Product_Subcategory,

     Product_category,

      FileBaseName() as FullName,

     subfield(FileBaseName(),' ',1) as FirstName

FROM

(biff, embedded labels, table is Sheet1$);

fbname.PNG

View solution in original post

5 Replies
Chanty4u
MVP
MVP

Hi you can try below with your code

a:

LOAD Product_Id,

     Product_Line,

     Product_Subcategory,

     Product_category,

     FileBaseName() as new,

     subfield(FileBaseName(),' ',1) as x

FROM

(biff, embedded labels, table is Sheet1$);

Chanty4u
MVP
MVP

Hi

check below code

LOAD Product_Id,

     Product_Line,

     Product_Subcategory,

     Product_category,

      FileBaseName() as FullName,

     subfield(FileBaseName(),' ',1) as FirstName

FROM

(biff, embedded labels, table is Sheet1$);

fbname.PNG

techvarun
Specialist II
Specialist II

Use below code in load script

Subfield(FileBaseName(),' ',1)

madhumitha
Creator
Creator
Author

Thanks Varun

It works Fine.

Anil_Babu_Samineni

Is they filenames coming from any external source as field? If so, SubField(FieldName, ' ',1) as FieldName

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful