Importing the entire content of a .txt file into a single cell

Here is one way that might work if there is no quoted text in the file:

Edit the text file to insert a quote " character at the beginning of the first paragraph and the end of the last.

After you select the file you will get a preview showing the data in multiple columns this time. Change the Delimiter to "Custom" but leave the custom delimiter box empty. It should now show everything in one cell.

(I will try to expand this answer later with a method using a Power Query M formula which is accessed through the Transform Data button on the preview window.)


  • Hit transform at the bottom of the window
  • Then use the M Code below
    • Import the file as a single column
    • Combine the column into a list
    • Save and Load
      • when you do this, the List will be saved into a single cell (with lf to separate each original row)
      • apply wordwrap to the cell

eg:

M Code

let
    Source = Csv.Document(File.Contents("C:\Users\ron\Desktop\data.csv"),1,"",ExtraValues.Ignore,65001),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}}),
    
    comb = Text.Combine(#"Changed Type"[Column1],"#(lf)")
in
    comb