Transfer Data From One Sheet to another in Excel

Transfer Data From One Sheet to another in Excel

This blog post is for you if you regularly work on Excel files. In any business organization, there are a number of tasks that take place on a daily basis related to data transfer and compilation. However, it becomes a hassle if the quantity of data is enormous. Therefore, automating the data transfer from one Workbook/Worksheet to another gives a competitive edge. In this article, you will learn to transfer data from one sheet to another in Excel using this JavaScript library.

The following topics will be covered:

Transfer Data From One Sheet to another in Excel | Node.js library installation

The quickest way to install this JavaScript Excel library is to either download the API package or install it by running the following commands:

npm install java
npm install aspose.cells

Excel transfer data from one sheet to another

Once the installation is done, we can transfer data from one Excel sheet to another programmatically.

You can follow the steps and the code snippet mentioned below:

  1. Instantiate an instance of the Workbook class and load the source XLSX/XLS file.
  2. Create a Worksheets object with reference to the sheets of the Workbook by calling the getWorksheets method.
  3. Invoke the addCopy method to copy data to a new sheet from an existing sheet within the Workbook.
  4. Save the Excel file by calling the save method.

Copy & paste the following code into your main file:

The output can be seen in the image below:

Excel transfer data from one sheet to another

Copy data from one Workbook to another

In addition, you can copy and move data from one Excel Workbook to another Workbook using a few lines of source code in JavaScript.

These are the steps:

  1. Create an object of the Workbook class and load the source XLSX/XLS file.
  2. Create another Workbook object.
  3. Copy the first sheet of the first book into the second book by calling the copy(source) method.
  4. Invoke the save method to save the file.

You can see the output in the image below:

Copy data from one Workbook to another

Get a Free License

You can avail a free temporary license to try the API without evaluation limitations.

Summing up

To conclude, you have learned how to transfer data from one sheet to another in Excel programmatically. Moreover, you also have gone through how to copy data from one Workbook to another using this JavaScript Excel library. Finally, do not forget to visit the documentation to know other awesome features.

Moreover, we suggest you follow our Getting Started guide.

Finally, conholdate.com is writing new blog posts. So, please stay in touch for regular updates.

Ask a question

You can let us know about your questions or queries on our forum.

FAQs

How do I automatically transfer data from one Excel sheet to another?

Please follow this link to achieve data transfer among sheets programmatically.

See Also