How to Create an Office Script to Archive and Delete Job Rows in Excel Online
Question details
The user needs an automated script to search for a job number, copy a specific 15-row block to an archive sheet, and delete the original rows from active dashboards.

- Product
- Excel Online (Excel for the web)
- Device & OS
- not provided
- Scenario
- An engineer needs to archive completed jobs by moving a specific 15-row group of data from an active dashboard to an archive sheet without rebuilding the workbook's architecture.
- Observed behavior
- The user requires a custom Office Script to identify the matching job number, copy the data block, and remove the original entries to keep the active sheets clean.
Ensure your Microsoft 365 enterprise or educational plan includes access to Office Scripts, and check that the Automate tab is enabled in your Excel for the web ribbon.
Outline Office Script Logic and Seek Developer Support
Since multi-row manipulation across sheets requires custom TypeScript, outline the core logic of your script and use the Microsoft Q&A community for precise implementation syntax.
Excel for the web relies on TypeScript-based Office Scripts rather than traditional VBA macros. To handle this multi-sheet, multi-row manipulation, you need to create a custom script.
The script must define variables to capture the target job number, locate the 15-row range in your Dashboard and engineer sheets, execute a copy command to the Archive sheet, and finally delete the original rows.
Open your workbook in Excel Online and click on the 'Automate' tab located in the top ribbon.
Click 'New Script' to open the Code Editor pane on the right side of your browser window.
Write the TypeScript structure to read the designated cell containing the job number, search the active sheet for this value, define the offset to select 15 rows, copy the range to the 'Archive' sheet, and use the range.delete() method for the original data.
Because this requires specific Office Scripts development, post your workbook structure and logic outline in the Microsoft Q&A Community using the 'Office Development' tag to get the exact code snippet.

Try WPS Office for Powerful Desktop Macro Capabilities
If you find Office Scripts in Excel Online difficult to manage or debug, consider using WPS Office for desktop. WPS Office offers robust traditional VBA and JavaScript Macro support, making it easier to automate complex tasks like archiving multi-row data blocks without relying strictly on web-based enterprise scripts.

Frequently Asked Questions
Can I use traditional VBA macros in Excel Online?
No, Excel Online does not support VBA (Visual Basic for Applications). Instead, it uses TypeScript-based Office Scripts for automation. To use VBA, you must open the workbook in the desktop version of Excel or use a capable alternative like WPS Office.
How do I enable the Automate tab in Excel for the web?
The Automate tab is available to users with a commercial or educational Microsoft 365 license. If you have the correct license, the tab should appear automatically on the ribbon. If it is missing, your organization's Microsoft 365 administrator may have disabled Office Scripts.
What is the difference between Office Scripts and Power Automate?
Office Scripts are used to automate actions directly within an Excel workbook, such as copying and deleting specific rows. Power Automate is a workflow service that connects different applications, but it can trigger your Office Scripts to run automatically on a schedule or based on specific events.
Is it possible to archive rows automatically without writing code?
While complex conditional multi-row moves usually require scripts or macros, you can use Power Automate's visual interface to filter rows and move data between tables without writing raw TypeScript code. However, selecting exactly 15 dynamic rows related to a single job number will likely still require advanced logical functions.




