shaunreeder
New Member
- Joined
- Aug 10, 2022
- Messages
- 3
- Office Version
- 365
- 2016
- Platform
- Windows
- MacOS
Hello all,
I have a script I made in Excel Web to automate a task when adding data to the spreadsheet.
It works fine and has no issues but it's a little bit of a delay from when the user clicks the button and the data populates on the sheet.
Any ideas on how can I help speed up the script while keeping the same functionality?
I have a script I made in Excel Web to automate a task when adding data to the spreadsheet.
It works fine and has no issues but it's a little bit of a delay from when the user clicks the button and the data populates on the sheet.
Any ideas on how can I help speed up the script while keeping the same functionality?
JSON:
function main(workbook: ExcelScript.Workbook) {
//disable auto calculation mode
workbook.getApplication().setCalculationMode(ExcelScript.CalculationMode.manual);
//Gets the current work sheet
let currentWorksheet = workbook.getActiveWorksheet();
//Gets Last row of used range
let usedRange = currentWorksheet.getUsedRange(true).getLastRow().getRowIndex();
//Gets Selected Provider
var setprovider = currentWorksheet.getRange('D1').getValue()
var week = currentWorksheet.getRange('B1').getValue()
//Gets Next Rows Range
const nextrow = currentWorksheet.getRangeByIndexes(usedRange+1,0,9,5);
//Adds The new rows to bottom of the table
nextrow.setValues([
//Weekly Metrics
["Weekly", week, setprovider, , "AtlantiCare First"],
["Weekly", week, setprovider, , "Weekly Visits"],
["Weekly", week, setprovider, , "Missing Charges"],
//Monthly Metrics
["Monthly", week, setprovider, , "Time To Be Seen Access %"],
["Monthly", week, setprovider, , "No Show Rate"],
["Monthly", week, setprovider, , "Panel Size"],
["Monthly", week, setprovider, , "Rate The Provider Score"],
["Monthly", week, setprovider, , "RVU Production"],
["Monthly", week, setprovider, , "Wellness Visit % Completion"],
]);
//Copys a new Provider Data Validation List
const getpdv = workbook.getWorksheet('Data Validation').getRange('C1');
const setproviderselection = currentWorksheet.getRange('D1').copyFrom(getpdv);
//Copys a new Weekly Data Validation List
const getwdv = workbook.getWorksheet('Reporting Weeks').getRange('M3');
const setweeklyselection = currentWorksheet.getRange('B1').copyFrom(getwdv);
nextrow.getUsedRange().select()
//turn it back on
workbook.getApplication().setCalculationMode(ExcelScript.CalculationMode.automatic);
}