SOLVED
Home

Prevent Power Query from deleting data after comma in data files

%3CLINGO-SUB%20id%3D%22lingo-sub-869898%22%20slang%3D%22en-US%22%3EPrevent%20Power%20Query%20from%20deleting%20data%20after%20comma%20in%20data%20files%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-869898%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20all%2C%3C%2FP%3E%3CP%3Ecan%20someone%20please%20help%20me%20with%20this%20issue%3A%3C%2FP%3E%3CP%3EI%20am%20importing%20multiple%26nbsp%3B.txt%20files%20from%20a%20folder%20(Get%20Data%20--%26gt%3B%20From%20File%20--%26gt%3B%20From%20Folder).%3C%2FP%3E%3CP%3EEach%20of%20these%20files%20contain%20hundreds%20of%20lines.%20A%20lot%20of%20these%20lines%20(but%20not%20all)%26nbsp%3Blook%20like%20this%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%5B2019-09-11%2015%3A51%3A54%5D%20Tests%3A%20test%20finished%2C%20Passed%20(Test%20Information)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIn%20my%20query%20I%20basically%20want%20the%20content%20of%20the%20files%20as%20is%20(in%20one%20cell)%26nbsp%3Bso%20I%20can%20sort%20specific%20lines%20individually.%3C%2FP%3E%3CP%3EMy%20problem%20now%20is%3A%3C%2FP%3E%3CP%3EI%20select%20%22Combine%20%26amp%3B%20Edit%22%20but%20no%20matter%20which%20kind%20of%20Delimiter%20I%20use%20(Fixed%20width%20and%20%220%22%20or%20Custom%20and%20%22blank%22)%20the%20query%20always%20deletes%20all%20characters%20after%20the%20comma%2C%20i.e.%20look%20like%20this%3C%2FP%3E%3CP%3E%5B2019-09-11%2015%3A51%3A54%5D%20Tests%3A%20test%20finished%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EDoes%20someone%20know%20how%20I%20can%20prevent%20this%3F%20I%20could%20import%20the%20files%20as%20text%20file%20but%20this%20is%20not%20really%20on%20option%20as%20I%20need%20to%26nbsp%3Bload%20several%20thousand%20of%20such%20files%20into%20the%20query%20and%20as%20far%20as%20I%20know%20the%20option%20%22From%20Text%22%20only%20allows%20loading%20of%20single%20files%20-%20not%20complete%20folders.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20upfront%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-869898%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EBI%20%26amp%3B%20Data%20Analysis%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EPower%20BI%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-869941%22%20slang%3D%22en-US%22%3ERe%3A%20Prevent%20Power%20Query%20from%20deleting%20data%20after%20comma%20in%20data%20files%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-869941%22%20slang%3D%22en-US%22%3ECan%20you%20please%20attach%20a%20sample%20file%20with%201%20or%202%20lines%20(anonymized)%20of%20data%3F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-870051%22%20slang%3D%22en-US%22%3ERe%3A%20Prevent%20Power%20Query%20from%20deleting%20data%20after%20comma%20in%20data%20files%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-870051%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F22322%22%20target%3D%22_blank%22%3E%40Jan%20Karel%20Pieterse%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESure.%20I%20have%20problems%20in%20uploading%20them%20though.%3C%2FP%3E%3CP%3EI%20pasted%20an%20example%20below.%20By%20simply%26nbsp%3Bcopy%2Fpaste%20this%20into%20a%20text%20editor%20and%26nbsp%3Bsave%20the%20file%20as%20a%26nbsp%3B*.log%20file%20will%20be%20basically%20the%20same%20as%20the%20original%20file.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%5B2019-09-11%2015%3A50%3A58%5D%20Diagnostics%3A%20preparing%20for%20tests%20101%2C%20201%2C%20203%2C%20901%3CBR%20%2F%3E%5B2019-09-11%2015%3A51%3A00%5D%20Diagnostics%3A%20test%20finished%2C%20Passed%20(101%20%7C%20Preparation)%3CBR%20%2F%3E%5B2019-09-11%2015%3A51%3A01%5D%20Diagnostics%3A%20test%20started%20(201%20%7C%20Camera%20Movement)%3CBR%20%2F%3EInstruction%20was%20not%20accepted%3A%20CAMERA%3AIMAGETAKEN%26nbsp%3B%3CBR%20%2F%3E%5B2019-09-11%2015%3A51%3A19%5D%20Diagnostics%3A%20test%20finished%2C%20Passed%20(201%20%7C%20Camera%20Movement)%3CBR%20%2F%3E%5B2019-09-11%2015%3A51%3A21%5D%20Diagnostics%3A%20test%20started%20(203%20%7C%20Barcode%20Read%20Test)%3CBR%20%2F%3EInstruction%20was%20not%20accepted%3A%20CAMERA%3AIMAGETAKEN%26nbsp%3B%3CBR%20%2F%3E%5B2019-09-11%2015%3A51%3A27%5D%20Diagnostics%3A%20test%20finished%2C%20Passed%20(203%20%7C%20Barcode%20Read%20Test)%3CBR%20%2F%3E%5B2019-09-11%2015%3A51%3A28%5D%20Diagnostics%3A%20test%20started%20(901%20%7C%20Reset%20Instrument)%3CBR%20%2F%3EInstruction%20was%20not%20accepted%3A%20CAMERA%3AIMAGETAKEN%26nbsp%3B%3CBR%20%2F%3EInstruction%20was%20not%20accepted%3A%20DIAG%3ALIST%20%22*%22%3CBR%20%2F%3E%5B2019-09-11%2015%3A51%3A38%5D%20Diagnostics%3A%20test%20finished%2C%20Passed%20(901%20%7C%20Reset%20Instrument)%3CBR%20%2F%3E%5B2019-09-11%2015%3A51%3A48%5D%20Diagnostics%3A%20test%20started%20(101%20%7C%20Preparation)%3CBR%20%2F%3E%5B2019-09-11%2015%3A51%3A48%5D%20Diagnostics%3A%20preparing%20for%20tests%20101%2C%20201%2C%20203%2C%20901%3CBR%20%2F%3E%5B2019-09-11%2015%3A51%3A54%5D%20Diagnostics%3A%20test%20finished%2C%20Passed%20(101%20%7C%20Preparation)%3CBR%20%2F%3E%5B2019-09-11%2015%3A51%3A55%5D%20Diagnostics%3A%20test%20started%20(201%20%7C%20Camera%20Movement)%3CBR%20%2F%3E%5B2019-09-11%2015%3A52%3A13%5D%20Diagnostics%3A%20test%20finished%2C%20Passed%20(201%20%7C%20Camera%20Movement)%3CBR%20%2F%3E%5B2019-09-11%2015%3A52%3A15%5D%20Diagnostics%3A%20test%20started%20(203%20%7C%20Barcode%20Read%20Test)%3CBR%20%2F%3E%5B2019-09-11%2015%3A52%3A20%5D%20Diagnostics%3A%20test%20finished%2C%20Passed%20(203%20%7C%20Barcode%20Read%20Test)%3CBR%20%2F%3E%5B2019-09-11%2015%3A52%3A22%5D%20Diagnostics%3A%20test%20started%20(901%20%7C%20Reset%20Instrument)%3CBR%20%2F%3EInstruction%20was%20not%20accepted%3A%20DIAG%3ALIST%20%22*%22%3CBR%20%2F%3E%5B2019-09-11%2015%3A52%3A32%5D%20Diagnostics%3A%20test%20finished%2C%20Passed%20(901%20%7C%20Reset%20Instrument)%3CBR%20%2F%3E%5B2019-09-11%2015%3A52%3A53%5D%20Diagnostics%3A%20test%20started%20(101%20%7C%20Preparation)%3CBR%20%2F%3E%5B2019-09-11%2015%3A52%3A53%5D%20Diagnostics%3A%20preparing%20for%20tests%20101%2C%20201%2C%20203%2C%20901%3CBR%20%2F%3E%5B2019-09-11%2015%3A52%3A55%5D%20Diagnostics%3A%20test%20finished%2C%20Passed%20(101%20%7C%20Preparation)%3CBR%20%2F%3E%5B2019-09-11%2015%3A52%3A56%5D%20Diagnostics%3A%20test%20started%20(201%20%7C%20Camera%20Movement)%3CBR%20%2F%3E%5B2019-09-11%2015%3A53%3A13%5D%20Diagnostics%3A%20test%20finished%2C%20Passed%20(201%20%7C%20Camera%20Movement)%3CBR%20%2F%3E%5B2019-09-11%2015%3A53%3A15%5D%20Diagnostics%3A%20test%20started%20(203%20%7C%20Barcode%20Read%20Test)%3CBR%20%2F%3E%5B2019-09-11%2015%3A53%3A20%5D%20Diagnostics%3A%20test%20finished%2C%20Passed%20(203%20%7C%20Barcode%20Read%20Test)%3CBR%20%2F%3E%5B2019-09-11%2015%3A53%3A22%5D%20Diagnostics%3A%20test%20started%20(901%20%7C%20Reset%20Instrument)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20for%20the%20help!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-870090%22%20slang%3D%22en-US%22%3ERe%3A%20Prevent%20Power%20Query%20from%20deleting%20data%20after%20comma%20in%20data%20files%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-870090%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F413468%22%20target%3D%22_blank%22%3E%40RaMa87%3C%2FA%3E%20I%20copied%20your%20sample%20data%20into%20a%20new%20textfile%20named%20%22%3CFONT%20style%3D%22background-color%3A%20%23ffffff%3B%22%3ENew%20Text%20Document.log%3C%2FFONT%3E%22.%3C%2FP%3E%0A%3CP%3EThen%20I%20clicked%20Get%20Data%2C%20From%20FIle%2C%20From%20Text%2FCSV%20and%20pointed%20at%20that%20file.%20I%20accepted%20the%20selected%26nbsp%3B%20defaults%20and%20clicked%20%22Close%20and%20Load%20to%22%20and%20chose%20to%20load%20it%20to%20a%20table.%20See%20attached.%3C%2FP%3E%0A%3CP%3EIf%20you%20refresh%20the%20query%20will%20fail%2C%20but%20if%20you%20go%20into%20the%20query%20and%20edit%20the%20first%20step%20you%20can%20point%20it%20to%20the%20correct%20file%20and%20location.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-870099%22%20slang%3D%22en-US%22%3ERe%3A%20Prevent%20Power%20Query%20from%20deleting%20data%20after%20comma%20in%20data%20files%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-870099%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F413468%22%20target%3D%22_blank%22%3E%40RaMa87%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBased%20on%20your%20sample%20data%2C%20Fixed%20Width%20with%200%20worked%20for%20me%20and%20here%20is%20the%20output%20in%20query%20editor.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20578px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F133125iA8956077B35C0B43%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22PQ%20Output.jpg%22%20title%3D%22PQ%20Output.jpg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-870103%22%20slang%3D%22en-US%22%3ERe%3A%20Prevent%20Power%20Query%20from%20deleting%20data%20after%20comma%20in%20data%20files%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-870103%22%20slang%3D%22en-US%22%3EYes%2C%20that%20works.%20However%2C%20this%20is%20not%20necessarily%20feasible%20since%20no%20batch%20loading%20is%20possible%20then%20(which%20would%20be%20kind%20of%20tedious%20to%20load%20%26gt%3B40.000%20files).%3CBR%20%2F%3EHowever%2C%20a%20solution%20was%20already%20found.%20Thanks%20anyways%20for%20your%20efforts!%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-870104%22%20slang%3D%22en-US%22%3ERe%3A%20Prevent%20Power%20Query%20from%20deleting%20data%20after%20comma%20in%20data%20files%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-870104%22%20slang%3D%22en-US%22%3EThanks!%20For%20whatever%20reason%20that%20works%20now%3F!%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-870105%22%20slang%3D%22en-US%22%3ERe%3A%20Prevent%20Power%20Query%20from%20deleting%20data%20after%20comma%20in%20data%20files%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-870105%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F413468%22%20target%3D%22_blank%22%3E%40RaMa87%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENo%20problem!%20Glad%20your%20issue%20got%20resolved.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-870106%22%20slang%3D%22en-US%22%3ERe%3A%20Prevent%20Power%20Query%20from%20deleting%20data%20after%20comma%20in%20data%20files%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-870106%22%20slang%3D%22en-US%22%3EI%20just%20used%20this%20simple%20aproach%20to%20show%20I%20did%20not%20experience%20a%20problem%20with%20your%20file.%3C%2FLINGO-BODY%3E
RaMa87
Occasional Contributor

Hi all,

can someone please help me with this issue:

I am importing multiple .txt files from a folder (Get Data --> From File --> From Folder).

Each of these files contain hundreds of lines. A lot of these lines (but not all) look like this:

 

[2019-09-11 15:51:54] Tests: test finished, Passed (Test Information)

 

In my query I basically want the content of the files as is (in one cell) so I can sort specific lines individually.

My problem now is:

I select "Combine & Edit" but no matter which kind of Delimiter I use (Fixed width and "0" or Custom and "blank") the query always deletes all characters after the comma, i.e. look like this

[2019-09-11 15:51:54] Tests: test finished

 

Does someone know how I can prevent this? I could import the files as text file but this is not really on option as I need to load several thousand of such files into the query and as far as I know the option "From Text" only allows loading of single files - not complete folders.

 

Thanks upfront

8 Replies
Can you please attach a sample file with 1 or 2 lines (anonymized) of data?

@Jan Karel Pieterse 

Sure. I have problems in uploading them though.

I pasted an example below. By simply copy/paste this into a text editor and save the file as a *.log file will be basically the same as the original file.

 

[2019-09-11 15:50:58] Diagnostics: preparing for tests 101, 201, 203, 901
[2019-09-11 15:51:00] Diagnostics: test finished, Passed (101 | Preparation)
[2019-09-11 15:51:01] Diagnostics: test started (201 | Camera Movement)
Instruction was not accepted: CAMERA:IMAGETAKEN 
[2019-09-11 15:51:19] Diagnostics: test finished, Passed (201 | Camera Movement)
[2019-09-11 15:51:21] Diagnostics: test started (203 | Barcode Read Test)
Instruction was not accepted: CAMERA:IMAGETAKEN 
[2019-09-11 15:51:27] Diagnostics: test finished, Passed (203 | Barcode Read Test)
[2019-09-11 15:51:28] Diagnostics: test started (901 | Reset Instrument)
Instruction was not accepted: CAMERA:IMAGETAKEN 
Instruction was not accepted: DIAG:LIST "*"
[2019-09-11 15:51:38] Diagnostics: test finished, Passed (901 | Reset Instrument)
[2019-09-11 15:51:48] Diagnostics: test started (101 | Preparation)
[2019-09-11 15:51:48] Diagnostics: preparing for tests 101, 201, 203, 901
[2019-09-11 15:51:54] Diagnostics: test finished, Passed (101 | Preparation)
[2019-09-11 15:51:55] Diagnostics: test started (201 | Camera Movement)
[2019-09-11 15:52:13] Diagnostics: test finished, Passed (201 | Camera Movement)
[2019-09-11 15:52:15] Diagnostics: test started (203 | Barcode Read Test)
[2019-09-11 15:52:20] Diagnostics: test finished, Passed (203 | Barcode Read Test)
[2019-09-11 15:52:22] Diagnostics: test started (901 | Reset Instrument)
Instruction was not accepted: DIAG:LIST "*"
[2019-09-11 15:52:32] Diagnostics: test finished, Passed (901 | Reset Instrument)
[2019-09-11 15:52:53] Diagnostics: test started (101 | Preparation)
[2019-09-11 15:52:53] Diagnostics: preparing for tests 101, 201, 203, 901
[2019-09-11 15:52:55] Diagnostics: test finished, Passed (101 | Preparation)
[2019-09-11 15:52:56] Diagnostics: test started (201 | Camera Movement)
[2019-09-11 15:53:13] Diagnostics: test finished, Passed (201 | Camera Movement)
[2019-09-11 15:53:15] Diagnostics: test started (203 | Barcode Read Test)
[2019-09-11 15:53:20] Diagnostics: test finished, Passed (203 | Barcode Read Test)
[2019-09-11 15:53:22] Diagnostics: test started (901 | Reset Instrument)

 

Thanks for the help!

 

@RaMa87 I copied your sample data into a new textfile named "New Text Document.log".

Then I clicked Get Data, From FIle, From Text/CSV and pointed at that file. I accepted the selected  defaults and clicked "Close and Load to" and chose to load it to a table. See attached.

If you refresh the query will fail, but if you go into the query and edit the first step you can point it to the correct file and location.

Solution

@RaMa87 

Based on your sample data, Fixed Width with 0 worked for me and here is the output in query editor.

 

PQ Output.jpg

Yes, that works. However, this is not necessarily feasible since no batch loading is possible then (which would be kind of tedious to load >40.000 files).
However, a solution was already found. Thanks anyways for your efforts!
Thanks! For whatever reason that works now?!

@RaMa87 

No problem! Glad your issue got resolved.

I just used this simple aproach to show I did not experience a problem with your file.
Related Conversations
Tabs and Dark Mode
cjc2112 in Discussions on
38 Replies
Extentions Synchronization
Deleted in Discussions on
3 Replies
flashing a white screen while open new tab
Deleted in Discussions on
14 Replies
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
Security Community Webinars
Valon_Kolica in Security, Privacy & Compliance on
13 Replies