rap2hpoutre / fast-excel

🦉 Fast Excel import/export for Laravel
MIT License
2.08k stars 246 forks source link

The empty cells in excel is considered as string (""), which should be NULL. #326

Closed anuragyadav8949 closed 12 months ago

anuragyadav8949 commented 1 year ago

Response from ExcelExport for sheet with ["column1"]=> int(1) ["column2"]=>NULL

Response from FastExcel on the sheet ["column1"]=>int(1) ["column2"]=>string(0) ""

Did the var dump and found this, while doing importSheets() the empty cells records are coming as empty string and 'column2' => $value['column2'] ?? null, check is failing, which is giving value as "", instead of null @rap2hpoutre @StyleCIBot

StefanoTesla commented 1 year ago

Not true, it only depens on how the cell if formatted, if you format it as Text the result is "" if the cell is formatted as number, this will be null, if is formatted as General, excel will decide for yourself.

I found it after hours of headhake..

rap2hpoutre commented 12 months ago

Thank you for your question @anuragyadav8949 and thank you for explanations @StefanoTesla (and sorry for your headache!).

I guess it's OK to keep it like this. By the way, maybe you can map over the collection to fix the null/empty issue?