Я пытаюсь преобразовать код vba в C#. У меня неплохой прогресс, но две нижние строчки в моем коде выдают ошибки. Что мне нужно изменить, чтобы этот код функционировал должным образом?
Application oApp = new Application();
Workbook wb = oApp.Workbooks.Open("C:\\Test\\Test Data.xlsx");
var firstSheet = (_Worksheet) wb.ActiveSheet;
Range last = firstSheet.Cells.SpecialCells(XlCellType.xlCellTypeLastCell, Type.Missing);
Range range = firstSheet.get_Range("A1", last);
int lastRow = last.Row;
int lastColumn = last.Column;
long outputColumn;
long tempCol1;
long tempCol2;
string dataVal;
string letterVal;
string decodedVal;
outputColumn = lastColumn + 1;
tempCol1 = lastColumn + 2;
tempCol2 = lastColumn + 3;
//this gives build errors
Excel.Columns(lastColumn).Copy(Excel.Columns(tempCol1));
Excel.Cells(1, tempCol1).Delete();
EDIT
Я получаю ошибку сборки The name `Excel` does not exist in the current context