@OM Developer AU I am happy to help. If this answer was helpful please consider accepting and upvoting to help other uses find answers.
For the error you are getting, it should work fine if you use indices in order and the payload is ok. So here are two things you could be doing wrong.
First case:
If you have a table that has "address": "Sheet1!A1:D5", and try to create a column whose index is 99 , that index does not exist in this table because cells A TO D has 0-3 indices and 99 is out. So ensure the index falls within your table.
Second case:
If you are passing wrong values and not matching the row values for the column.
If you table has "address": "Sheet1!A1:D5", values has to be a list of values including the column name. For example, the below will create the last column on table with "address": "Sheet1!A1:D5" with 5 row fields.
POST /me/drive/items/{item-id}/workbook/tables/Table1/columns
{
"id": "4",
"name": "Column4",
"index": 3,
"values": [
[
"Column3"
],
[
"value 1"
],
[
"value 2"
],
[
"value 3"
],
[
"value 4"
],
[
"value 5"
]
]
}
That said, I think the documentation creating columns https://learn.microsoft.com/en-us/graph/api/table-post-columns?view=graph-rest-1.0&tabs=http is insufficient on explaining usage of the value field.