-
-
Notifications
You must be signed in to change notification settings - Fork 0
Table.AddColumnFromList
Rodrigo Celso de Lima Porto edited this page Jan 13, 2026
·
1 revision
Adds a new column to a table using values from a provided list. The new column can be inserted at a specified position and can have a defined data type.
Table.AddColumnFromList(
tbl as table,
columnName as text,
columnValues as list,
optional position as number,
optional columnType as type
) as table-
tbl: The input table to which the new column will be added. -
columnName: The name of the new column to be added. -
columnValues: A list of values to populate the new column. -
position(optional): The position (0-based index) where the new column should be inserted. If not specified, the column is added at the end. -
columnType(optional): The data type of the new column. If not specified, the column will have typeany.
Returns a new table with the added column populated with values from the provided list. If the list has fewer items than the number of rows in the table, nulls are added for the remaining rows. If the list has more items than the number of rows, extra items are ignored.
- If the
positionparameter is provided, the new column will be inserted at the specified index. If the index is out of bounds, an error will occur. - If the
columnTypeparameter is provided, the new column will be created with the specified data type. If not provided, the column will have typeany.
Example 1: Add a list as a new column at the end of the table.",
let
Source = Table.FromRecords({[A=1, B=2], [A=3, B=4]}),
NewColumnValues = {10, 20},
Result = Table.AddColumnFromList(Source, "C", NewColumnValues)
in
ResultResult
| A | B | C |
|---|---|---|
| 1 | 2 | 10 |
| 3 | 4 | 20 |
Example 2: Add a list as a new column at a specific position with a defined data type.
let
Source = Table.FromRecords({[A=1, B=2], [A=3, B=4]}),
NewColumnValues = {10, 20},
Result = Table.AddColumnFromList(Source, "C", NewColumnValues, 2, Int64.Type)
in
ResultResult
| A | C | B |
|---|---|---|
| 1 | 10 | 2 |
| 3 | 20 | 4 |
Example 3: If list has fewer items than rows, nulls are added for remaining rows.
let
Source = Table.FromRecords({[A=1, B=2], [A=3, B=4], [A=5, B=6]}),
NewColumnValues = {10, 20},
Result = Table.AddColumnFromList(Source, "C", NewColumnValues)
in
ResultResult
| A | B | C |
|---|---|---|
| 1 | 2 | 10 |
| 3 | 4 | 20 |
| 5 | 6 | null |
Example 4: If list has more items than rows, extra items are ignored.
let
Source = Table.FromRecords({[A=1, B=2], [A=3, B=4]}),
NewColumnValues = {10, 20, 30, 40},
Result = Table.AddColumnFromList(Source, "C", NewColumnValues)
in
ResultResult
| A | B | C |
|---|---|---|
| 1 | 2 | 10 |
| 3 | 4 | 20 |
- Binary.Unzip πβοΈ
- DateTime.ToUnixTime πβοΈ
- Decision.EntropyWeights πβοΈ
- Decision.TOPSIS πβοΈ
- List.Correlation πβοΈ
- List.Intercept πβοΈ
- List.Outliers πβοΈ
- List.PopulationStdDev πβοΈ
- List.Primes πβοΈ
- List.Rank πβοΈ
- List.Slope πβοΈ
- List.Variance πβοΈ
- List.WeightedAverage πβοΈ
- Number.FromRoman πβοΈ
- Number.IsInteger πβοΈ
- Number.IsPrime πβοΈ
- Number.ToRoman πβοΈ
- Statistical.NormDist πβοΈ
- Statistical.NormInv πβοΈ
- Table.AddColumnFromList πβοΈ
- Table.CorrelationMatrix πβοΈ
- Table.NormalizeColumnNames πβοΈ
- Table.NormalizeTextColumns πβοΈ
- Table.RemoveBlankColumns πβοΈ
- Table.TransposeCorrectly πβοΈ
- Text.CountChar πβοΈ
- Text.ExtractNumbers πβοΈ
- Text.HtmlToPlainText πβοΈ
- Text.RegexExtract πβοΈ
- Text.RegexReplace πβοΈ
- Text.RegexSplit πβοΈ
- Text.RegexTest πβοΈ
- Text.RemoveAccents πβοΈ
- Text.RemoveDoubleSpaces πβοΈ
- Text.RemoveLetters πβοΈ
- Text.RemoveNumerals πβοΈ
- Text.RemovePunctuations πβοΈ
- Text.RemoveStopwords πβοΈ
- Text.RemoveWeirdChars πβοΈ
- AreArraysEquals πβοΈ
- AutoFillFormulas πβοΈ
- CleanString πβοΈ
- DisableRefreshAll πβοΈ
- EnableRefreshAll πβοΈ
- FileExists πβοΈ
- FileNameIsValid πβοΈ
- GetAllFileNames πβοΈ
- GetLetters πβοΈ
- GetMonthNumberFromName πβοΈ
- GetStringBetween πβοΈ
- GetStringWithSubstringInArray πβοΈ
- GetTableColumnNames πβοΈ
- IsAllTrue πβοΈ
- IsInArray πβοΈ
- ListObjectExists πβοΈ
- PreviousMonthNumber πβοΈ
- RangeHasAnyFormula πβοΈ
- RangeHasConstantValues πβοΈ
- RangeIsHidden πβοΈ
- RangeToHtml πβοΈ
- SendEmail πβοΈ
- SetQueryFormula πβοΈ
- StringContains πβοΈ
- StringEndsWith πβοΈ
- StringStartsWith πβοΈ
- SubstringIsInArray πβοΈ
- Summation πβοΈ
- TableHasQuery πβοΈ
- WorksheetHasListObject πβοΈ