Forum Discussion
How to reference Text in a Cell to create a new column
- 5 years ago
Hi Anonymous
SheetCellA4 =YourWorkSheet[Column1]{3}Please mark the question solved when done and consider giving a thumbs up if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
Cheers
- 5 years ago
Hello Anonymous
you are using an approach of accessing a xlsx-file even you are accessing a csv-file. In your case the Source-step will give you already the final table. So use this code instead
let Source = Csv.Document(File.Contents("C:\Users\cday\OneDrive - udfinc.com\M6 Scorecard\Data Pulls\4 Wk Data.csv"),[Delimiter=",", Columns=18, Encoding=1252, QuoteStyle=QuoteStyle.None]), #"Added Custom" = Table.AddColumn(Source, "Custom", each Query1(Source)) in #"Added Custom"If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too
Have fun
Jimmy
AlB Thanks, I made the adjustment, and tried to add a new column:
= Table.AddColumn(Source, "Custom", each Query1(Source{[Item= "Sheet1", Kind="Sheet"]}[Data]))
But I'm getting an error:
How do I fix this?
Anonymous
You seem to be adding a whole table in each of the rows of the column you are creating. That can't work. What are you trying to do exactly? I'd need to see the whole code (and that of functions if you use any)
Please mark the question solved when done and consider giving a thumbs up if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
Cheers
- Anonymous5 years agoNot applicable
I open a new workbook, and add this Blank Query:
(YourWorkSheet as table ) as text=> let SheetCellA4 =YourWorkSheet[Column1]{3}, SplitByFrom = Text.Split(SheetCellA4, "'From: "){1}, SplitByTime = Text.Split(SplitByFrom, "`"){0}, GetTimeFrame = Text.Start(SplitByTime, Text.Length(SplitByTime)-1) in GetTimeFrameI then add my Data Source
Then I want to Add a Column with the Text String that I am pulling from Query1:
let Source = Csv.Document(File.Contents("C:\Users\cday\OneDrive - udfinc.com\M6 Scorecard\Data Pulls\4 Wk Data.csv"),[Delimiter=",", Columns=18, Encoding=1252, QuoteStyle=QuoteStyle.None]), #"Added Custom" = Table.AddColumn(Source, "Custom", each Query1(Source{[Item= "Sheet1", Kind="Sheet"]}[Data])) in #"Added Custom"So I need to take the A4 text string:
Current Weeks : 'From: 2020 PD 09 WK 1 (33) to 2020 PD 09 WK 4 (36)`
And add a Column with only:
2020 PD 09 WK 1 (33) to 2020 PD 09 WK 4 (36)
- Jimmy8015 years agoCommunity Champion
Hello Anonymous
you are using an approach of accessing a xlsx-file even you are accessing a csv-file. In your case the Source-step will give you already the final table. So use this code instead
let Source = Csv.Document(File.Contents("C:\Users\cday\OneDrive - udfinc.com\M6 Scorecard\Data Pulls\4 Wk Data.csv"),[Delimiter=",", Columns=18, Encoding=1252, QuoteStyle=QuoteStyle.None]), #"Added Custom" = Table.AddColumn(Source, "Custom", each Query1(Source)) in #"Added Custom"If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too
Have fun
Jimmy - AlB5 years agoCommunity Champion
Anonymous
Ah, so Query1 is the function, I assume? Then it looks good. Can you share the csv so that I can have a look on the real thing? I haven't come across that error message before
Please mark the question solved when done and consider giving a thumbs up if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
Cheers
- Anonymous5 years agoNot applicable