Forum Discussion
Importing text values with commas
greg_wallace , here are at least two ways.
You may use legacy file import wizard which is switched off by default. To switch it on File->Options
and use it from Data->Get data->Legacy wizard. On the second step of the wizard select single quote as text qualifier
If import by default From Text/CSV it recognises double quote as text qualifier, i.e. text like
"something","company, inc",1,2,3
it will be split correctly. I don't know the way to define single quote as text qualifier. You may modify a script a bit from user interface. On first step instead of Load click transform, in formula bar modify first step of the query as import without delimiter, after that replace single quote on double one and split column with comma as delimiter.
Generated script looks like
let
Source = Csv.Document(File.Contents("C:\Test\commas.txt"),[Delimiter=""""]),
ReplaceQuote = Table.ReplaceValue(Source,"'","""",Replacer.ReplaceText,{"Column1"}),
SplitColumn = Table.SplitColumn(ReplaceQuote, "Column1", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv),
{"Column1.1", "Column1.2", "Column1.3", "Column1.4", "Column1.5"})
in
SplitColumn
SergeiBaklan Thanks for the heads up about the legacy wizards under the Get Data menu. To get my job done yesterday, I copied and pasted the data and the old wizard appeared. I will test if I can get my source to use double quotes. I'll also test the scritps.