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
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
Hello Mynda,
When I expand I then have to Delimit the data by "|" and I still don't see the file name.
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
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
Hi Vanessa,
No file was attached. You have to click the 'start upload' button to actually complete the upload.
Mynda
I kept the highlighted columns and removed the others.
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
BTW, you use Csv.Document for Text or CSV files. Be careful with the case of this function.
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.
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