Search notes:

Microsoft.Office.Interop.Excel (namespace)

Source code

using System;
using Excel = Microsoft.Office.Interop.Excel;

class E {

   private static Excel.Range getRange(Excel.Worksheet sh, int row1, int col1, int row2, int col2) {
      Excel.Range rng1 = sh.Cells[row1, col1];
      Excel.Range rng2 = sh.Cells[row2, col2];
      return sh.Range[rng1, rng2];
   }

   public static void Main(string[] args) {

      try {

          Excel.Application excel;
          Excel.Workbook    workbook;
          Excel.Worksheet   sheet;

          excel = new Excel.Application();
          excel.Visible = true;

          workbook = excel.Workbooks.Add(System.Reflection.Missing.Value);
          sheet    = workbook.ActiveSheet;

          sheet.Cells[1, 1] = "Number" ;
          sheet.Cells[1, 2] = "English";
          sheet.Cells[1, 3] = "German" ;

          sheet.Cells[1, 4] = "Formula";

          Excel.Range header = getRange(sheet, 1,1 , 1,4);
          header.Font.Bold         = true;
//        header.VerticalAlignment = Excel.XlVAlign.xlVAlignCenter;
          header.Interior.Color    = System.Drawing.Color.FromArgb(200, 200, 200);

          object[,] values = new object[,] {
             { 1 , "one"   , "eins" },
             { 2 , "two"   , "zwei" },
             { 3 , "three" , "drei" },
             { 4 , "four"  , "vier" },
             { 5 , "five"  , "fünf" }
          };

          int valuesHeight = values.GetLength(0);
          int valuesWidth  = values.GetLength(1);

          getRange(sheet,
            2,                   1                 ,
            2 + valuesHeight -1, 1 + valuesWidth -1
          ).Value2 = values;

          Excel.Range formula = getRange(sheet, 2               , 1+valuesWidth,
                                                2+valuesHeight-1, 1+valuesWidth);

          formula.FormulaR1C1 = "=rc[-3] & \": \" & rc[-2] & \"-\" & rc[-1]";

          Excel.Range columns = getRange(sheet, 1,1 , 1,5);
          columns.EntireColumn.AutoFit();

          excel.UserControl = true;
      }
      catch (Exception e) {
          Console.WriteLine($"Error: {e.Message} Line: {e.Source}");
      }
   }
}
Github repository .NET-API, path: /Microsoft/Office/Interop/Excel/intro.cs

Compling for .NET Core

& "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Roslyn\csc.exe"                               `
  /noconfig                                                                                                                        `
  /preferreduilang:en-US                                                                                                           `
  /reference:"C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\3.0.0\ref\netcoreapp3.0\Microsoft.CSharp.dll"                `
  /reference:"C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\3.0.0\ref\netcoreapp3.0\mscorlib.dll"                        `
  /reference:"C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\3.0.0\ref\netcoreapp3.0\netstandard.dll"                     `
  /reference:"C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\3.0.0\ref\netcoreapp3.0\System.Console.dll"                  `
  /reference:"C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\3.0.0\ref\netcoreapp3.0\System.Linq.Expressions.dll"         `
  /reference:"C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\3.0.0\ref\netcoreapp3.0\System.Drawing.Primitives.dll"       `
  /reference:"C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\3.0.0\ref\netcoreapp3.0\System.Runtime.dll"                  `
  /reference:"C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\3.0.0\ref\netcoreapp3.0\System.Runtime.InteropServices.dll"  `
  /link:C:\Windows\assembly\GAC_MSIL\Microsoft.Office.Interop.Excel\15.0.0.0__71e9bce111e9429c\Microsoft.Office.Interop.Excel.dll  `
  /warnaserror+                                                                                                                    `
  /out:intro.dll                                                                                                                   `
  intro.cs

#  /link:C:\Windows\assembly\GAC_MSIL\Office\15.0.0.0__71e9bce111e9429c\Office.dll  `
#  /link:C:\Windows\assembly\GAC_MSIL\Microsoft.Vbe.Interop\15.0.0.0__71e9bce111e9429c\Microsoft.Vbe.Interop.dll  `

Github repository .NET-API, path: /Microsoft/Office/Interop/Excel/compile.ps1

intro.runtimeconfig.json

When executing for .NET core, the DLL requires an *.runtimeconfig.json file:
{
  "runtimeOptions": {
    "tfm": "netcoreapp3.0",
    "framework": {
      "name": "Microsoft.NETCore.App",
      "version": "3.0.0"
    }
  }
}
Github repository .NET-API, path: /Microsoft/Office/Interop/Excel/intro.runtimeconfig.json

Executing with dotnet.exe

PS P:\ath\to\dir> dotnet.exe intro.dll

See also

Microsoft.Office.Interop.….Constants
PowerShell: Convert CSV files in a directory to Excel Workbooks
Powershell + Microsoft.Office.Interop.Excel

Index