Home » Php » How do I remove '-' from headers in sheet for Maatwebsite import?

How do I remove '-' from headers in sheet for Maatwebsite import?

Posted by: admin September 25, 2018 Leave a comment

Questions:

I am using this package for importing csv files into my Laravel 5.3 app. Great package! Thanks Maatwebsite.

I am having an issue though. I need to import a csv file that I am not able to control the header format of. Header labels contain a hyphen (e.g. EXAMPLE-HEADER). The hyphen is causing php to look at the second part of the label as new constant and then throwing error because it’s undefined.

What is the proper way to address this. Knowing that the hyphens will always be used in the file (comes from 3rd party).

Thanks!

Answers: