diff --git a/includes/webform.submissions.inc b/includes/webform.submissions.inc
index 048a6aa..f9fc6ae 100644
--- a/includes/webform.submissions.inc
+++ b/includes/webform.submissions.inc
@@ -658,19 +658,15 @@ function webform_submission_render($node, $submission, $email, $format, $exclude
     foreach ($excluded_components as $cid) {
       unset($components[$cid]);
     }
-    if (!empty($email['exclude_empty'])) {
-      foreach ($submission->data as $cid => $data) {
-        // Caution. Grids store their data in an array index by question key.
-        if (implode($data) == '') {
-          unset($components[$cid]);
-        }
-      }
-    }
   }
 
   module_load_include('inc', 'webform', 'includes/webform.components');
   _webform_components_tree_build($components, $component_tree, 0, $page_count);
 
+  if (!empty($email['exclude_empty'])) {
+    _webform_submission_remove_empty_components($submission->data, $components, $component_tree);
+  }
+
   // Make sure at least one field is available.
   if (isset($component_tree['children'])) {
     // Recursively add components to the form.
@@ -688,6 +684,50 @@ function webform_submission_render($node, $submission, $email, $format, $exclude
 }
 
 /**
+ * Remove all components without values and all fieldsets without children.
+ *
+ * @param $data
+ *   Submission data from webform_submission_render().
+ * @param $components
+ *   Components from webform_submission_render().
+ * @param $tree
+ *   Component tree or child tree from webform_submission_render() or recursion.
+ * @return
+ *   TRUE: tree doesn't have children.
+ *   FALSE: tree has children.
+ */
+function _webform_submission_remove_empty_components($data, &$components, &$tree) {
+  foreach ($tree['children'] as $key => $child) {
+    if (!isset($data[$child['cid']]) || (is_array($data[$key]) && _webform_submission_recursive_is_empty_array($data[$key]))) {
+      // TODO Add hook so modules can implement more form element types with children.
+      if ($child['type'] != 'fieldset' || _webform_submission_remove_empty_components($data, $components, $tree['children'][$key])) {
+        unset($tree['children'][$key]);
+        unset($components[$key]);
+      }
+    }
+  }
+  return count($tree['children']) == 0;
+}
+
+/**
+ * Checks if an array is empty, regardless of how many levels there are in the array.
+ */
+function _webform_submission_recursive_is_empty_array(array $array) {
+  foreach ($array as $key => $value) {
+    if (!is_array($value)) {
+      if (!empty($value)) {
+        return FALSE;
+      }
+    }
+    elseif (!_webform_submission_recursive_is_empty_array($value)) {
+      return FALSE;
+    }
+  }
+
+  return TRUE;
+}
+
+/**
  * Return all the submissions for a particular node.
  *
  * @param $filters
