Forum Discussion
HerbertC
2 years agoRegular Visitor
Split Data In Multiple Columns
Good evening folks, I have data that is emailed to me daily with a grade and the price of the grade. My challenge is that the data is arrange in double columns that go across the page. How can I ...
- 2 years ago
Hi, if you don't need PDF name use this code:
let // Google Drive Link Source = Web.Contents("https://drive.google.com/uc?export=download&id=16en6fo7n-5VR-virg1DoezUzsRmHmYfi"), ExcelWorkbook = Excel.Workbook(Source), MatrixData_Table = ExcelWorkbook{[Item="MatrixData",Kind="Table"]}[Data], Transformed = Table.Combine(List.Transform(List.Split(List.Skip(Table.ToColumns(MatrixData_Table)), 2), each Table.FromColumns(_, Value.Type(Table.SelectColumns(MatrixData_Table, List.FirstN(List.Skip(Table.ColumnNames(MatrixData_Table)),2)))))) in TransformedIf you want to preserve PDF names, use this code:
let // Google Drive Link Source = Web.Contents("https://drive.google.com/uc?export=download&id=16en6fo7n-5VR-virg1DoezUzsRmHmYfi"), ExcelWorkbook = Excel.Workbook(Source), MatrixData_Table = ExcelWorkbook{[Item="MatrixData",Kind="Table"]}[Data], GroupedRows = Table.Group(MatrixData_Table, {"Date"}, {{"All", each Table.Combine(List.Transform(List.Split(List.Skip(Table.ToColumns(_)), 2), (x)=> Table.FromColumns(x, Value.Type(Table.SelectColumns(_, List.FirstN(List.Skip(Table.ColumnNames(_)),2)))))), type table}}), ExpandedAll = Table.ExpandTableColumn(GroupedRows, "All", {"Grade", "Average Price"}, {"Grade", "Average Price"}), FilteredRows = Table.SelectRows(ExpandedAll, each ([Grade] <> null and [Grade] <> "")), ChangedType = Table.TransformColumnTypes(FilteredRows,{{"Grade", type text}, {"Average Price", Currency.Type}}, "en-US") in ChangedType
HerbertC
2 years agoRegular Visitor
Thanks jgeddes
The solution is not very far off. How can I attach an excel or CSV file so that you have the actuall data?
Regards
Herbert
jgeddes
Super User
2 years agoThe easiest way to share a file is to post a link to a file saved in cloud storage such as OneDrive. Make sure the link allows access to the file.
Another method for sample data is that you can copy a section of data frpm your file and pasting it into the table feature of the reply headers of these messages.