| 1 |
// Transforms a table into markdown syntax |
| 2 |
(Table as table) => |
| 3 |
let |
| 4 |
Source = Table, |
| 5 |
TableValues = Table.AddColumn( |
| 6 |
Source, "Custom", each Text.Combine(Record.FieldValues(_), " | ") |
| 7 |
), |
| 8 |
HyphenLine = Text.Combine( |
| 9 |
List.Transform( |
| 10 |
Table.ColumnNames(Source), each Text.Repeat("-", Text.Length(_)) |
| 11 |
), |
| 12 |
" | " |
| 13 |
), |
| 14 |
CombineList = List.Combine( |
| 15 |
{{Text.Combine(Table.ColumnNames(Source), " | ")}, |
| 16 |
{HyphenLine}, TableValues[Custom]} |
| 17 |
), |
| 18 |
TransferToMarkdown = Text.Combine(CombineList, "#(lf)") |
| 19 |
in |
| 20 |
TransferToMarkdown |
| 21 |
|
| 22 |
// From https://github.com/mogulargmbh/powerquerysnippets/blob/main/snippets/Table_ToMarkdown.pq |
| 23 |
|