I need to export my Model to .xlsx and to submit some parameters (checkbox) for axlsx template. 

I have a controller "leads" and custom post action "export", which should invoke my export.xlsx.axlsx template:

```
def export
  respond_to do |format|
      format.xlsx ## here is invoking my export.xlsx.axlsx
  end
end

```

In my routes.rb I have the following:

```
resources :leads do
  collection { post :ipmort }
end

```

I am trying to implement the following view:

```
<%= form_tag export_leads_path do %> 
  <%= button_to "Export to Excel", {controller: 'leads', action: "export", 
      remote: true, form: { "data-type" => "xlsx" }} %>
<% end %>

```

But when I click this button I have got html data format, but not xlsx![enter image description here](https://i.stack.imgur.com/NlJCl.png)

Is there any possibility to specify respond\_to format in submit\_tag, button\_to?

I have tried to use <%= link\_to %> but then I cannot get my form params..

```
<%= form_tag export_leads_path do %> 
  <%= link_to "Excel", export_leads_path(format: "xlsx", commit: "Excel"), method: :post %>
<% end %>

```

Here i haven't lead\_ids params:

![enter image description here](https://i.stack.imgur.com/48vB5.png)

I also have tried <% submit\_tag %>, but result was the same as <%= button\_to %>

Please help me, I have spent all the day struggling with this issue and have no thoughts what can I do else.. Let me know if you need any additional information and I will provide it as soon as possible! 

Thanks in advance!