<h2 dir="auto">Summary</h2>
<p dir="auto">It would be great to have a simple way to change the field names for the output.</p>
<h2 dir="auto">Motivation</h2>
<p dir="auto">When we define an item class we usually use <a href="https://docs.scrapy.org/en/latest/topics/items.html#declaring-item-subclasses" rel="nofollow">Python variables for the names of the fields</a>.<br>
However in the output files we'd rather have correctly spelled headers.<br>
But if we use the current approach, we only have the variables names as headers by default:<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/49591562/170603916-98f3fda5-d444-4301-a749-d1022a619eaa.png"><img src="https://user-images.githubusercontent.com/49591562/170603916-98f3fda5-d444-4301-a749-d1022a619eaa.png" alt="header of result speadsheet from scrapy" style="max-width: 100%;"></a></p>
<h2 dir="auto">Describe alternatives you've considered</h2>
<p dir="auto">I wondered if <a href="https://stackoverflow.com/a/69675451" rel="nofollow">using an <strong>init</strong> function for the item class</a> would be the recommended way.<br>
Or are there other options?</p>
<p dir="auto">Sometimes we may require defining field names that are not valid Python variables (for example containing spaces). I believe the correct way of doing this right now is that the developer needs to add a Pipeline that maps the internal name to the name we wan't to export. Scrapy could ship with a Pipeline (maybe enabled by default) that does this mapping for fields that define a field parameter. For example:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="class MyItem(Item):
   date_from = Field(export_name='Initial date')"><pre class="notranslate"><code class="notranslate">class MyItem(Item):
   date_from = Field(export_name='Initial date')
</code></pre></div>
<p dir="auto">This is a very simple pipeline. However, since this is a very common use case, I think it is something that could be shipped by default. I'm happy to provide a PR for this.</p>