I am working on office.js
using jquery in Visual Studio 2015
I want to replace only some of the column data with new data in table and i don’t want to change other columns.
Can i do that?
You just need to get a Range object reference to the range you want to change and assign a two-dimensional array of values to it. If the position of the table is hardcoded, you can get the Range object you need with an explicit address like this:
var myRange = worksheet.getRange("A2:D9");
If you won’t know the table’s position at coding-time, another way to do it is to get the table’s data range and then cut off the rightmost column.
var myRange = myTable.getDataBodyRange().getResizedRange(0,-1);
Either way, you set the myRange.values property to an a two-dimensional array of the new values:
myRange.values = [
[30/06/2018, "Test11", 6000.31, 18/06/2016],
… // and so on for all the rows
]
Tags: excelexcel, replace