Wanted to accomplish below mentioned task, Having 2 Sheets(Sheet1 and Sheet 2) On clicking the Checkbox on Sheet 1:J1, data present in the table form on the Sheet 1 should get pasted in the single row of Sheet2 For eg Product 1 data (P1) to the Product 1 Column, Product 2 data (P2) to the Product 2 Column and so on... For every new submit, new data to be recorded on the next row of Sheet2. SS link: https://docs.google.com/spreadsheets/d/1tmnDOMyupjeO8d65qHQsxb5KrrKeq7pMYIE8h2VmEJ4/edit?usp=sharing
Thanks in advance
I believe your goal is as follows.
In this case, how about the following sample script?
function onEdit(e) {
const range = e.range;
const sheet = range.getSheet();
if (sheet.getSheetName() != "Sheet1" || range.getA1Notation() != "H1" || !range.isChecked()) return;
const srcRange = sheet.getRange("A3:G6");
const [[b1], , , , , , , , , [b10]] = sheet.getRange("B1:B10").getValues();
const values = [b1, ...srcRange.getValues().flat(), b10];
const dstSheet = e.source.getSheetByName("Sheet2");
dstSheet.appendRow(values);
range.uncheck();
// srcRange.clearContent();
}
Cannot read property 'range' of undefined
occurs. Please be careful about this.srcRange.clearContent();
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.