diff --git a/src/export.php b/src/export.php index 66e19f6..2c360f9 100644 --- a/src/export.php +++ b/src/export.php @@ -66,7 +66,8 @@ function escape_csv($v) { //escape formulas $nf = ''; - if (strlen($v) > 0 && in_array(substr($v, 0, 1), array('=', '+', '-', '@'))) { + $trimmed = ltrim($v); + if (strlen($trimmed) > 0 && in_array(substr($trimmed, 0, 1), array('=', '+', '-', '@'))) { $nf = "'"; } return '"'. $nf. str_replace('"', '""', $v). '"';