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
custom column names before export #1565
Comments
Thanks for submitting the ticket. Unfortunately the information you provided is incomplete. Before we can pick it up, please check (https://github.com/Maatwebsite/Laravel-Excel/blob/3.0/.github/ISSUE_TEMPLATE.md) and add the missing information. To make processing of this ticket a lot easier, please make sure to check (https://laravel-excel.maatwebsite.nl/docs/3.0/getting-started/contributing) and double-check if you have filled in the issue template correctly. This will allow us to pick up your ticket more efficiently. Issues that follow the guidelines correctly will get priority over other issues. |
thanks for responding, it is not actually an issue, is just a question. i just want to know is such thing possible with help of this package or not? just simple that's all I'm asking. thanks. |
@robertnicjoo we still need you to fill in the relevant parts of the issue template. It doesn't matter if it's a question or a bug. We now don't have enough information to help you. The difference between 2.1 and 3.0 e.g. is huge and the answer would totally differ based on that information. Please fill in the issue template: https://github.com/Maatwebsite/Laravel-Excel/blob/3.0/.github/ISSUE_TEMPLATE.md |
@JeroenVossen @patrickbrouwers I have updated my question as you asked for, please help me solve my issue, thank you. |
any comment on that? |
@robertnicjoo Thanks for adding the information. We will pick it up as soon as we have resources available (as stated in our support guidelines (https://laravel-excel.maatwebsite.nl/docs/3.0/getting-started/support)). |
Ok, I get it to work with my custom names. There is tiny issue: My data row will repeat twice in excel file.
I edited CodesThis is my updated code: public function export(Request $request) {
$products = Product::all();
Excel::create('products', function($excel) use($products, $request) {
$excel->sheet('sheet 1', function($sheet) use($products, $request){
$ddd = $request->except('_token');
foreach($ddd as $fff){
$ddd[] = $fff;
}
$sheet->fromArray($products, null, 'A1', false, false);
$sheet->row(1, $ddd);
});
})->export('csv');
return redirect()->back();
} any idea? |
Thanks for no support of your creation. My problem has solved. |
What do you mean by this remark? I hope you realize this is open source software that is free for you to use, but holds no obligation for us on support. We will give support on the package itself on a best effort basis. If needed, we can also provide commercial support. Please read our support page |
Prerequisites
Versions
Description
Hi,
I would like to know is it possible for me to edit columns before exporting my CSV file or not?
For example I have products table where has
title
description
created_at
updated_at
what I want is to export something liketitle
body
as you see here i removedcreated_at
,updated_at
and also renamed mydescription
column tobody
is that possible?Steps to Reproduce
Expected behavior:
(What I want)
Actual behavior:
(What I have)
Additional Information
Any additional information, configuration or data that might be necessary to reproduce the issue.
Codes
currently I'm using default export code from samples, including no additional query etc. try to figure how should I change my code in order to export my data as I wish.
PS: what I try to create is exactly what this extension does in Magento,
As you can see in this extension we are able to
change default database column names
,add/remove columns
etc. (but i only need this two options), before export the data.The text was updated successfully, but these errors were encountered: