Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Urgent - During import showing dates instead of data in xls file #38

Closed
ashawkat opened this issue Mar 6, 2014 · 4 comments
Closed

Comments

@ashawkat
Copy link

ashawkat commented Mar 6, 2014

I'm trying to import dummy data from xls file. But instead of showing data i'm getting todays date. my xls file data are:
a b c d
adnan shawkat something done
asdfasd asdfsadf asdfasdf asdfsda

 if (Input::hasFile('file')){
        $file = Input::file('file');
        $ext = Input::file('file')->getClientOriginalExtension();
        echo $ext;
        if ($ext == "csv" || $ext == "xlsx" || $ext == 'xls'){
            echo "<pre>"; print_r(Excel::load($file, true)->select(array('a', 'd'))->dump());
            return "OK";
            }
        else return "not our type";
    } else return "not ok";

In the above code section i'm only getting the dates as output please see the output below:

xls

Array
(
[0] => Array
(
[a] => 2014-03-06
[d] => 2014-03-06
)

[1] => Array
    (
        [a] => 2014-03-06
        [d] => 2014-03-06
    )

)

OK

Can anyone please tell me what is wrong in there? It's getting the first row as heading but no data only dates why? Urgent please give me a solution.

@ashawkat
Copy link
Author

ashawkat commented Mar 6, 2014

I've tried to import an xls file but unable to import it. When importing a csv file according to earlier issue I've fixed that but still I can't import xls file. Is there any way to import xls or xlsx llike csv upload?

@MaatwebsiteSupport
Copy link
Contributor

I made an excel file with your data and imported it with the class, but I just get the values, not the dates.
Are you sure your file is okay? When cells are formatted as dates, PHPExcel will format them to dates.
If you really want to stop parsing date cells, you could use the ->formatDates(false) chain.

@ashawkat
Copy link
Author

ashawkat commented Mar 6, 2014

I didn't knew that well. It works right now. Thanks a lot.

@MaatwebsiteSupport
Copy link
Contributor

You're welcome! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants