You can use the Excel’s VLOOKUP formula to pick individual cell values and show them on another worksheet as a reference. Please check the following code snippet that uses the same approach to show all values from Sheet1 on Sheet2. You can surely amend the code to achieve your custom requirement.
C#
Workbook workbook = new Workbook(myDir + “Book2.xlsx”);
Worksheet worksheet = workbook.Worksheets[1]; for (int i = 0; i <= 3; i++)
{ for (int j = 0; j <= 2; j++)
{
worksheet.Cells[i, j].Formula = “=VLOOKUP(Sheet1!A” + (i + 1) + “,data,” + (j + 1) + “,FALSE)”;
}
}
workbook.CalculateFormula();
workbook.Save(myDir + “VLOOKUP.xlsx”, SaveFormat.Xlsx);
You can also use the Aspose.Cells' Find functionality to seek for a particular text in a given spreadsheet, and copy the entire row to another worksheet. Please check the following code snippet and attached resultant spreadsheet for your reference.
I think your requirement can be achieved using macros, however, Aspose.Cells APIs do not support creation, manipulation or triggering of macros in a spreadsheet. The API can only preserve or remove them while processing a spreadsheet containing macros.
Could you please suggest any other related formula/suggestion to accomplish my requirement, as this formula looks complex and i need to copy in every cell.
Unfortunately, I couldn’t think of a simple formula that could enable you to copy an entire row from one worksheet to another, this is because; more the cells are involved more the formula will become complex. Anyway, you should be looking for a VBA based solution for your scenario. I think if you search the internet for VBA, you will find pretty simple modules to achieve your requirements.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.