我需要一些帮助,我可以在 Excel VBA 中完成,但在 Excel Online 中找不到。我有下面的示例 1 工作,但它不是动态的,我需要将它粘贴到最后一行下。如果您可以提供帮助,请提供示例或编辑代码并重新发送。谢谢你。
//Example 1
function main(workbook: ExcelScript.Workbook) {
let data_sheet = workbook.getWorksheet("Data")
let progr_sheet = workbook.getWorksheet("Programming");
// Paste to range A1 on progr_sheet from range A4:L19 on data_sheet
progr_sheet.getRange('A4').copyFrom(data_sheet.getRange("A4:L19"), ExcelScript.RangeCopyType.all, false, false);
}
//Example 2 [Below doesn't work just and example of what I am trying to do.]
// function main(workbook: ExcelScript.Workbook) {
// let data_sheet = workbook.getWorksheet("Data")
// let progr_sheet = workbook.getWorksheet("Programming");
// let myUsedRange = progr_sheet.getUsedRange();
// let lastRow = myUsedRange.getRowCount();
// console.log(lastRow) +1;
// // Paste to range column A (lastRow) on progr_sheet from range A4:L19 on data_sheet
// progr_sheet.getRange('A & lastRow').copyFrom(data_sheet.getRange("A4:L19"), ExcelScript.RangeCopyType.all, false, false);
//}