title: Google BigQuery REST API C# copy/export table with nested schema as CSV
body: <p>Is there a way to export a whole table with a nested schema from Google BigQuery using the REST API as a CSV?</p>
  
  <p>There is an example for doing this (<a href="https://cloud.google.com/bigquery/docs/exporting-data" rel="nofollow noreferrer">https://cloud.google.com/bigquery/docs/exporting-data</a>) with a not nested schema. This works fine on the not nested columns in my table. Here is the code of this part:</p>
  
  <pre><code>PagedEnumerable&lt;TableDataList, BigQueryRow&gt; result2 = client.ListRows(datasetId, result.Reference.TableId);
          StringBuilder sb = new StringBuilder();
          foreach (var row in result2)
          {
              sb.Append($"{row["visitorId"]}, {row["visitNumber"]}, {row["totals.hits"]}{Environment.NewLine}");
          }
  
          using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(sb.ToString())))
          {
              var obj = gcsClient.UploadObject(bucketName, fileName, contentType, stream);
          }
  </code></pre>
  
  <p>In BQ there are columns like totals.hits, totals.visits...If I try to address them  I got the errormessage that there is not such a column. If I am addressing "totals" I get the objectname "System.Collections.Generic.Dictionary`2[System.String,System.Object]" in the rows in my csv.</p>
  
  <p>Is there any possibility to do something like that? In the end I want my table from GA in BQ as a CSV somewhere else.</p>