Forum

Text files from fol...
 
Notifications
Clear all

Text files from folder to include name

11 Posts
2 Users
0 Reactions
81 Views
(@cqs2016)
Posts: 12
Active Member
Topic starter
 

How do you include the file name when importing .TXT files from a folder? I did not see anything in chapter 2.05. Example: I have a folder that receives daily .txt files. I would like to download the data along with the file name. This will assist in data searching.

Thanks

 
Posted : 15/10/2016 7:13 am
(@mynda)
Posts: 4761
Member Admin
 

Hi Vanessa,

Just make sure the 'Name' column is not one of the 'Remove Other Columns' before you click on the double down arrow to expand the binary. Hold CTRL and select the Name column AND the Content column, then choose 'Remove Other Columns'.

Then you can expand the binary and you will have a column for the file name and the data from within the files.

I hope that makes sense. Give it a go and let me know if you get stuck.

Mynda

 
Posted : 15/10/2016 7:28 am
(@cqs2016)
Posts: 12
Active Member
Topic starter
 

Hello Mynda,

When I expand I then have to Delimit the data by "|" and I still don't see the file name.

 
Posted : 16/10/2016 12:36 pm
(@mynda)
Posts: 4761
Member Admin
 

Hi Vanessa,

The filename column should be there before you expand. Can you please share a sample of your data so we can give you a sample solution in return.

Thanks,

Mynda

 
Posted : 17/10/2016 7:27 am
(@cqs2016)
Posts: 12
Active Member
Topic starter
 

Good Day,

I highlighted in green the columns I was keeping and Remove the others. Every time I get the file it does not include Name. Is there a limit to columns? It stops at 67. Thanks

 
Posted : 18/10/2016 3:33 pm
(@mynda)
Posts: 4761
Member Admin
 

Hi Vanessa,

No file was attached. You have to click the 'start upload' button to actually complete the upload.

Mynda

 
Posted : 18/10/2016 9:20 pm
(@cqs2016)
Posts: 12
Active Member
Topic starter
 

I kept the highlighted columns and removed the others.

MOLT1.jpg

 
Posted : 20/10/2016 9:34 am
(@mynda)
Posts: 4761
Member Admin
 

Sorry, Vanessa.

I forgot when you want to keep columns other than just the Binary content you need to follow a process similar to importing Excel files from a folder.

That is, instead of clicking on the double down arrow to expand the Binaries, you need to Add a Custom Column and insert this formula:

=Csv.Document([Content])

Then you can delete the 'Content' column and expand the Custom column. This way you will keep the Name and Date Modified columns when you expand the data.

Let me know if you get stuck.

 

Mynda

 
Posted : 21/10/2016 7:14 am
(@mynda)
Posts: 4761
Member Admin
 

BTW, you use Csv.Document for Text or CSV files. Be careful with the case of this function.

 
Posted : 21/10/2016 7:14 am
(@cqs2016)
Posts: 12
Active Member
Topic starter
 

That worked! Thank you. Where is the best place to locate the different custom column formulas like this? Just to get more familiar with the options...thanks again and have a great day.

 
Posted : 25/10/2016 11:19 am
(@mynda)
Posts: 4761
Member Admin
 

Hi Vanessa,

Glad that worked.

Aside from the course you can find the formula library online here: https://msdn.microsoft.com/en-us/library/mt211003.aspx

Plus the bonus eBook included with teh course; "M is for (DATA) Monkey" also has lots of examples.

Kind regards,

Mynda

 
Posted : 26/10/2016 6:21 am
Share: