![](/img/trans.png)
[英]how to copy cells from a specific range from one excel workbook to another workbook using c#
[英]Copy specific columns from one excel spreadsheet to another in C#
这是您可能想尝试的另一件事(代码使用GemBox.Spreadsheet库 ):
ExcelFile source = ExcelFile.Load("Source.xlsx");
ExcelColumn sourceColumn = source.Worksheets[0].Columns[0];
ExcelFile destination = ExcelFile.Load("Destination.xlsx");
ExcelColumn destinationColumn = destination.Worksheets[0].Columns[0];
int count = source.Worksheets[0].Rows.Count;
for (int i = 0; i < count; i++)
destinationColumn.Cells[i].Value = sourceColumn.Cells[i].Value;
destination.Save("Destination.xlsx");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.