Dec 24 2021 01:10 AM
Hi all,
I need your help as I cannot record the actions I need to perform to generate script.
I have a data query loaded in the excel workbook and I need it to be automatically be put in an existing blank sheet as a table so I can view and refresh Data.
Thank you in advance for your help!!
Dec 24 2021 01:16 AM
Dec 24 2021 01:26 AM
@funkyfoenky This script takes the first table on the active sheet, inserts a new worksheet and pastes that table in the same location on the new sheet:
function main(workbook: ExcelScript.Workbook) {
let selectedSheet = workbook.getActiveWorksheet();
let sourceTbl: ExcelScript.Table = selectedSheet.getTables()[0];
let topLeftAddress = sourceTbl.getRange().getCell(0, 0).getAddress().split("!")[1]
let newSht = workbook.addWorksheet();
newSht.getRange(topLeftAddress).copyFrom(sourceTbl.getRange(), ExcelScript.RangeCopyType.values, false, false);
let newTable = workbook.addTable(newSht.getRange(topLeftAddress).getSurroundingRegion(), true);
}
Dec 24 2021 01:31 AM
Dec 24 2021 06:35 AM
@Jan Karel Pieterse It is working but it doesn't solve my final goal.
It is possible with script to Delete a table then map a new table based on a data connexion?
Dec 24 2021 08:19 AM
Dec 26 2021 05:43 AM
OK here is what I need to perform:
I have 3 data queries inside a workbook: (sorry screenshot is in french)
From these queries I would like to create a table in A1 on a dedicated sheet (Deviation, CAPA, Other CAPA Plan) after updating the queries. Tables should be named Deviation_Table, CAPA_Table and Other_CAPA_Plan_Table respectively.
I usually create it by hand using Excel desktop application: (Example from Deviation query)
Thank you in advance for your help
Dec 28 2021 08:24 AM
Dec 30 2021 02:19 AM - edited Dec 30 2021 02:21 AM