Skip to content

Instantly share code, notes, and snippets.

@ImkeF
Last active September 19, 2017 18:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ImkeF/8e49f73d98b371ae978c210c16ad9bff to your computer and use it in GitHub Desktop.
Save ImkeF/8e49f73d98b371ae978c210c16ad9bff to your computer and use it in GitHub Desktop.
M functions
let
// Fetches your function library from a csv-file: 3 columns "Column1" is autogenerated and will be removed, "GetCode" hold code and "Name" the name of the function
// Adjust "Path" to your own machine:
Path = "C:\Users\imkef\Desktop\ImkesFunctions.csv",
// The Encoding parameters might need to be adjusted to local settings
Source = Csv.Document(File.Contents(Path),[Delimiter=",", Columns=3, Encoding=1252, QuoteStyle=QuoteStyle.Csv]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", Int64.Type}, {"Column2", type text}, {"Column3", type text}}),
#"Promoted Headers" = Table.PromoteHeaders(#"Changed Type", [PromoteAllScalars=true]),
#"Removed Columns" = Table.RemoveColumns(#"Promoted Headers",{"Column1"}),
EvaluateFunction = Table.AddColumn(#"Removed Columns", "Value", each Expression.Evaluate([GetCode], #shared)),
Cleanup = Table.RemoveColumns(EvaluateFunction,{"GetCode"}),
ToRecord = Record.FromTable(Cleanup)
in
ToRecord
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment