title: Exporting NDWI values with Dates as CSV from Google Earth Engine
body: <p>my goal is to create a csv file from the data that is chosen between dates. This was the code that I used for creating the NDWI values. I want to export that data with date so that I can create a graph from time series of NDWI - date. But I could not found how, any help is appreciated, thanks.</p>
  <pre><code>Map.centerObject(areaOfInterest);
  Map.addLayer(areaOfInterest);
  var startDate = '2018-07-01';
  var endDate = '2018-07-31';
  var sentinelImageCollection = ee.ImageCollection('COPERNICUS/S2')
                    .filterBounds(areaOfInterest)
                    .filterDate(startDate, endDate);
  
  print(&quot;Number of images = &quot;, sentinelImageCollection.size());
  
  // We select the image with the smallest cloudy pixel percentage
  var sentinelImage = sentinelImageCollection.sort('CLOUDY_PIXEL_PERCENTAGE')
      .first()
      .clip(areaOfInterest);
  
  print(&quot;Sentinel image taken at = &quot;, sentinelImage.date());
  
  // Visualize using RGB
  Map.addLayer(sentinelImage, {min: 0.0, max: 2000, bands: ['B4', 'B3', 'B2']}, 'RGB');
  
  // Visualize using NDWI
  var ndwi = sentinelImage.normalizedDifference(['B3', 'B8']).rename('NDWI');
  Map.addLayer(ndwi, {palette: ['red', 'yellow', 'green', 'cyan', 'blue']}, 'NDWI');
  
  // Calculate the area of our region of interest
  var aoiArea = ee.Image.pixelArea().divide(1e6).reduceRegion({
      reducer: ee.Reducer.sum(),
      geometry: areaOfInterest,
      scale: 10,
  }).get('area');
  print('AOI area (km2):', aoiArea);
  
  // Create NDWI mask
  var ndwiThreshold = ndwi.gte(0.0);
  var ndwiMask = ndwiThreshold.updateMask(ndwiThreshold);
  Map.addLayer(ndwiThreshold, {palette:['black','white']}, 'NDWI Binary Mask');
  Map.addLayer(ndwiMask, {palette:['blue']}, 'NDWI Mask');
  
  // We can now calculate the masked areas pixel area
  var ndwiPixelArea = ee.Image.pixelArea().addBands(ndwiMask.select('NDWI')).divide(1e6).reduceRegion({
      reducer: ee.Reducer.sum().group(1),
      geometry: areaOfInterest,
      scale: 10,
      bestEffort: true
  });
  
  var list = ee.List(ee.Dictionary(ndwiPixelArea).get('groups'));
  var group0 = ee.Dictionary(list.get(0));
  var ndwiWaterArea = ee.Number(group0.get('sum')).float();
  print(&quot;Water area (km2):&quot;, ndwiWaterArea);
  </code></pre>