Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

somnathsah's avatar

Laravel excel : remove extra space from file header and values

Hi,

I am using Laravel excel package to read excel file. I want to know, does it provide any method which I can use to remove extra spaces from all header and values of the file? I don't want to use function like trim for each rows.

Thanks in advance,

0 likes
3 replies
somnathsah's avatar

Thanks @Dry7, Yes I saw this earlier, this is good solution. But is there anything which I can add in config of excel or direct call any method on my reader object to remove the extra spaces from header and values.

ohffs's avatar

Don't know if it's any help, but I wrote a little wrapper around Spout to import & trim data seeing as I did it so often : https://github.com/ohnotnow/simple-spout

$data = (new ExcelSheet)->trimmedImport('/tmp/spreadsheet.xlsx');

Please or to participate in this conversation.