function copyShapes(copyCount) {
const presentation = SlidesApp.getActivePresentation();
const slide = presentation.getSlides()[0];
let group = slide.getGroups()[0];
const xIncrement = 10;
const yIncrement = 5.5;
const initialX = 0.25;
const initialY = 1;
const maxCopiesPerPage = 10;
for (let i = 0; i < copyCount; i++) {
if (i % maxCopiesPerPage === 0) {
if (i > 0) {
group = presentation.appendSlide(SlidesApp.PredefinedLayout.BLANK).insertGroup(group);
}
} else {
const positionIndex = i % maxCopiesPerPage;
const row = Math.floor(positionIndex / 2);
const col = positionIndex % 2;
const x = cmToPoints(initialX + col * xIncrement);
const y = cmToPoints(initialY + row * yIncrement);
group.duplicate().setLeft(x).setTop(y);
}
}
}
First of all, there is 1 figure group in Google Slide. Here, how many copies I want, the copies of the shape group are created according to their positions. but there are placeholders in the group, {{NAME1}} and {{PRICE1}}, {{NAME1}}, {{NAME2}},{{NAME3}} and so on for as many placeholders as I want to create copies.
{{PRICE1}},{{PRICE2}},{{PRICE3}}
Let the copies change as, for example, if I want 4 copies{{PRICE1}},{{PRICE2}},{{PRICE3}},{{PRICE4}}
And
{{NAME1}}, {{NAME2}},{{NAME3}},{{NAME4}}
Let it change one by one like this