I'm working on a script to automate the creation of a report, this script creates a google document and fills it with information from different sources, the report has a table that is copied from a Google Spreadsheet using the following code:
// get the Spreadsheet by sheet id
var source = SpreadsheetApp.openById(OPERATIONS_FILE);
// select the sheet
var sourcesheet = source.getSheetByName(OPERATION_SHEET);
// get the values on selectd range
var srcData = sourcesheet.getRange(OPERATION_RANGE).getValues();
// Set the variable templates on the new Report
var newReport = DocumentApp.openById( reportFile.getId() );
var reportBody = newReport.getBody();
reportBody.replaceText('{date}', dateForTitle);
reportBody.replaceText('{workWeek}', weekNumber[1]);
// Get the data from the Dashboard and put it on the Report
var range = reportBody.findText("{operation}");
var operationsTable = "";
var ele = range.getElement();
if (ele.getParent().getParent().getType() === DocumentApp.ElementType.BODY_SECTION) {
var offset = reportBody.getChildIndex(ele.getParent());
operationsTable = reportBody.insertTable(offset + 1, srcData);
}
Now the table inserted into the google document 'operationsTable' contains extra columns that I need to delete (those are needed on the spreadsheet for calculation purposes) I found RemoveRow(I) function on google script documentation but couldn't found RemoveColumn(I) how can you delete certain columns of a Table once is on Google Document?