I am trying to insert images into the google docs table and the table cells' dimensions keep changing which I don't want to happen. I have tried setting cell padding to zero and still not working. I also tried reducing the image size and that does not seem to work. Also, running my script takes a lot of time. How can I lessen the runtime of my script? Thanks in advance!
for (var i = 1; i < table.getNumRows(); i++) {
// Check if the current row is a condition row
if (conditionRows.indexOf(i) !== -1) {
var row = table.getRow(i);
// Loop through columns 0 to 4 to get the condition cells
for (var j = 0; j < 5; j++) {
var condition cell = row.getCell(j);
var condition = conditionCell.getText();
var pattern = /\s{2,}/g;
var replacement = " ";
var replacedCondition = condition.replace(pattern, replacement);
var inPutCondition = replacedCondition.trim().toLowerCase();
// Check if the condition text is in the map
if (inPutCondition in conditionImageMap) {
// Get the image URL from the map and insert the image in the previous row
var fileId = conditionImageMap[inPutCondition];
var previousRow = table.getRow(i - 1);
var previousCell = previousRow.getCell(j);
var file = DriveApp.getFileById(fileId);
var imageBlob = file.getBlob();
previousCell.clear(); previousCell.setPaddingTop(0).setPaddingBottom(0).setPaddingRight(0).setPaddingLeft(20).insertImage(0, imageBlob).setWidth(63).setHeight(63);