This article entails how to add a row in Excel using Node.js. It has the details to set the environment, a list of programming tasks, and a runnable sample code showing how to insert rows in Excel using Node.js. You will also learn different techniques to add one or more rows along with their impact on other rows and sheets.
Steps to Add Row in Excel using Node.js
- Configure the IDE to use Aspose.Cells for Node.js via Java to add a row
- Create an Excel file and access a worksheet for processing
- Add some test data in different rows in the sheet
- Insert a row in-between the rows containing sample data
- Save the resultant workbook after inserting a row
These steps summarize the process to insert rows in Excel using Node.js. Initially, a workbook is loaded and some sample data is inserted into a sheet for testing the feature. The insertRows() method is called by providing the target index row and the number of rows to be inserted before saving the output XLSX file.
Code to Insert Line in Excel using Node.js
This sample code demonstrates how to insert a new row in Excel using Node.js. It uses one of the overloaded methods of insertRows() that requires the target row index and the total number of rows to be added. If you want to insert rows and update the relevant references use the overloaded method insertRows(rowIndex, totalRows, updateReference) where you may set the totalRows to insert one or multiple rows and set the updateReference flag to update the references in the workbook.
This short article has described how to insert a line in Excel using Node.js. If you want to learn adjusting the column width in an Excel file, refer to the article on how to adjust column width in Excel using Node.js.