title: Google Fusion Tables Quota Exceeded when importing data
body: <p>I fill google fusion tables  . I've about 2mio entries which should be added to the fusion tables.</p>
  
  <p>I use  <a href="https://www.nuget.org/packages/Google.Apis.Fusiontables.v2/" rel="nofollow noreferrer"><strong>Google.Apis.Fusiontables.v2 1.10.0.50</strong></a></p>
  
  <p>This worked for some monthes. but now I get a quota exceeded exception.</p>
  
  <blockquote>
    <p>Google.Apis.Requests.RequestError Quota Exceeded [403] Errors [
        Message[Quota Exceeded] Location[ - ] Reason[quotaExceeded] Domain[usageLimits] ]</p>
  </blockquote>
  
  <p>As there are more data this isn't that surprising.</p>
  
  <p>But when I look at the quota on <a href="https://console.developers.google.com/apis/api/fusiontables/quotas" rel="nofollow noreferrer">https://console.developers.google.com/apis/api/fusiontables/quotas</a> I can't see any limitations were hit.</p>
  
  <p>Also in the global quota dashboard I can't see any limits I hit.</p>
  
  <p>I thought that I may hit the 250MB per table. but when I download the datasource the csv only has 40 MB
  But I think this are only read quotas not write?</p>
  
  <p><a href="https://i.stack.imgur.com/9tEYK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9tEYK.png" alt="enter image description here"></a></p>
  
  <pre><code>        private static void WriteItem()
          {
              await WriteAsync("map_data", index.AllEdges&lt;BusEdge&lt;TId&gt;&gt;().Where(x =&gt; x.MinFrequentPriceInEur &gt; 0), (busEdge, csvWriter) =&gt;
              {
                  WriteItem(busEdge, csvWriter);
  
                  itemHandled();
              });
          }
  
      private static void WriteItem(BusEdge&lt;TId&gt; busEdge, CsvWriter csvWriter)
      {
          csvWriter.WriteField(Source.Id.ToString());
          csvWriter.WriteField(sink.Id.ToString());
  
          csvWriter.WriteField(string.Format(CultureInfo.InvariantCulture, "{0} {1}",
              sink.Geolocation.Latitude,
              sink.Geolocation.Longitude));
  
          csvWriter.WriteField(sink.Population);
  
          foreach (Language language in Languages.AllLanguages)
          {
              csvWriter.WriteField(sink.DisplayName[language], true);
          }
  
          var priceWithDate =
              busEdge.Prices.GroupBy(x =&gt; x.Value.MinimumFrequentInEur)
                  .OrderByDescending(x =&gt; x.Count()).SelectMany(x =&gt; x)
                  .OrderBy(x =&gt; x.Key)
                  .FirstOrDefault();
  
          double price = priceWithDate.Value.MinimumFrequentInEur;
  
          csvWriter.WriteField(Math.Round(price, 2));
          csvWriter.WriteField(Math.Round(CurrencyInfo.EUR.ConvertMoney(price, CurrencyInfo.GBP), 2));
          csvWriter.WriteField(Math.Round(CurrencyInfo.EUR.ConvertMoney(price, CurrencyInfo.HRK), 2));
          csvWriter.WriteField(Math.Round(CurrencyInfo.EUR.ConvertMoney(price, CurrencyInfo.PLN), 2));
          csvWriter.WriteField(priceWithDate.Key.ToString("s"));
  
    public static async Task WriteAsync&lt;T&gt;(string tableName, IEnumerable&lt;T&gt; list, Action&lt;T, CsvWriter&gt; writerAction)
          {
              using (FusiontablesService service = Connect())
              {
                  var tables = service.Table.List().Execute();
                  var tableId = tables.Items.Where(x =&gt; x.Name == tableName).Select(x =&gt; x.TableId).First();
  
                  MemoryStream memoryStream = new MemoryStream();
  
                  bool hasWritten = false;
  
                  Func&lt;Task&gt; uploadAsync = async () =&gt;
                  {
                      if (memoryStream.Length &gt; 0)
                      {
                          memoryStream.Position = 0;
  
                          ResumableUpload&lt;string&gt; request =
                              hasWritten ?
                                  (ResumableUpload&lt;string&gt;)service.Table.ImportRows(tableId, memoryStream, "application/octet-stream") :
                                  (ResumableUpload&lt;string&gt;)service.Table.ReplaceRows(tableId, memoryStream, "application/octet-stream");
  
                          var response = await request.UploadAsync();
  
                          if (response.Exception != null)
                          {
                              throw response.Exception;
                          }
  
                          memoryStream = new MemoryStream();
  
                          hasWritten = true;
                      }
                  };
  
                  using (StreamWriter writer = new StreamWriter(memoryStream, Encoding.UTF8, 1024, true))
                  {
                      using (CsvWriter csvWriter = new CsvWriter(writer, new CsvConfiguration { Delimiter = "," }))
                      {
                          foreach (T item in list)
                          {
                              writerAction(item, csvWriter);
  
                              csvWriter.NextRecord();
  
                              writer.Flush();
  
                              if (memoryStream.Length &gt;= Limit)
                              {
                                  await uploadAsync();
                              }
                          }
                      }
                  }
  
                  await uploadAsync();
              }
  </code></pre>
  
  <p>Any advice how I can find out the specific limit ? and any recommandations on improvements in the code ?</p>