Function to download anonymous type data into excel
Actually you can have anonymous types as parameters - called dynamics - but IMO it's not pretty (and probably rather slow):

static void ConvertToDatatable(IEnumerable&lt;dynamic&gt; input)
{

  foreach (var i in input)
  {
    Type type = i.GetType();
    if (type.GetProperty("Age") != null)
      Console.WriteLine($"{i.Name}: {i.Age}");
    else
      Console.WriteLine($"{i.Name}: No age");
  }
}

static void DynamicTest()
{
  bool isTrue = true;

  IEnumerable&lt;object&gt; data = null;

  if (isTrue)
  {
    data = Enumerable.Range(1, 5).Select(i =&gt; new { Name = "Name " + i, Age = i * 10 });
  }
  else
  {
    data = Enumerable.Range(1, 5).Select(i =&gt; new { Name = "Name " + i });
  }

  ConvertToDatatable(data);
}




I think I'd use a classical OOP approach:

class BaseClass
{
  public string Name;
}

class Sub1 : BaseClass
{
  public double Age;
}

class Sub2 : BaseClass
{
  public int Age;
}

static void ConvertToDatatable(IEnumerable&lt;BaseClass&gt; input)
{
  foreach (var i in input)
  {
    if (i is Sub1)
      Console.WriteLine($"{i.Name}: {(i as Sub1).Age}");
    else if (i is Sub2)
      Console.WriteLine($"{i.Name}: {(i as Sub2).Age}");
    else
      Console.WriteLine($"{i.Name}: No age");
  }
}

static void BaseClassTest()
{
  bool isTrue = true;

  IEnumerable&lt;BaseClass&gt; data = null;

  if (isTrue)
  {
    data = Enumerable.Range(1, 5).Select(i =&gt; new Sub1 { Name = "Name " + i, Age = i * 10 });
  }
  else
  {
    data = Enumerable.Range(1, 5).Select(i =&gt; new BaseClass { Name = "Name " + i });
  }

  ConvertToDatatable(data);
}




Beside that, I think your naming is quite remarkable and rather hard to read because of the length:

For instance it's hard to quickly distinguish between:

vwTransactionInfoItemProcessesInDownloadFormat 

transactionInfoItemProcessesInDownloadFormat 

vwTransactionInfoItemProcesses