In some cases it may be useful to have cells that contain elements appear in the CSV. At the moment these are rendered blank but a quick fix would be to add something along the lines of:
if($(input).val()){
input = $(input).val();
}
to the formatData function.