# Date format in spreadsheet file Write to xlsx

**URL:** <https://community.n8n.io/t/date-format-in-spreadsheet-file-write-to-xlsx/27065>\
**Category:** Feature Requests\
**Tags:** spreadsheet-file\
**Created:** [June 12, 2023, 9:11am UTC](https://community.n8n.io/t/date-format-in-spreadsheet-file-write-to-xlsx/27065 "2023-06-12T09:11:52Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![lucabartoli](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/lucabartoli/32/4867_2.png) [@lucabartoli](https://community.n8n.io/u/lucabartoli)\
**Post date:** [June 12, 2023, 9:11am UTC](https://community.n8n.io/t/date-format-in-spreadsheet-file-write-to-xlsx/27065/1 "2023-06-12T09:11:52Z")

</div>

## Describe the problem/error/question

When outputting items to xlsx through the Spreadsheet file node, dates on the final spreadsheet are unformatted 1900 dates.

Everything works fine, but every time I get the resulting xlsx, I need to open it with excel and set the correct display format for the columns.

Is there a way to let the node knowing a value is a date, in order to let it use the correct `t="d"`?

## Information on your n8n setup

- **n8n version: 0.230.3**
- **Database (default: SQLite): SQLite**
- **n8n EXECUTIONS\_PROCESS setting (default: own, main): main**
- **Running n8n via (Docker, npm, n8n cloud, desktop app): docker**
- **Operating system: linux**

---

<div class="post-metadata">

**Author:** ![EmeraldHerald](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/emeraldherald/32/35355_2.png) [@EmeraldHerald](https://community.n8n.io/u/EmeraldHerald)\
**Post date:** [June 12, 2023, 9:58am UTC](https://community.n8n.io/t/date-format-in-spreadsheet-file-write-to-xlsx/27065/2 "2023-06-12T09:58:37Z")

</div>

Hi @lucabartoli - welcome back to the forums! 🖖

Does this post from my teammate Tom by chance fix up your issue?

> [@XSLX to SpreadSheet Node, Encountering DATE issues](http://community.n8n.io/t/xslx-to-spreadsheet-node-encountering-date-issues/25592/3):
>
> Hi @saica, this is expected as this is the type of value Excel uses to represent dates. Perhaps you want to try out [this expression](http://community.n8n.io/t/date-serial-number-to-normal-date/10891/4) I posted a while back to convert such dates? Still seems to work from giving this a quick go with your first value:

If that doesn’t help, could you share your workflow and some example data so we can see what you’re doing more in-depth?

---

<div class="post-metadata">

**Author:** ![lucabartoli](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/lucabartoli/32/4867_2.png) [@lucabartoli](https://community.n8n.io/u/lucabartoli)\
**Post date:** [June 12, 2023, 10:25am UTC](https://community.n8n.io/t/date-format-in-spreadsheet-file-write-to-xlsx/27065/3 "2023-06-12T10:25:47Z")

</div>

Hi @EmeraldHerald ,  
I already tried that. Not the exact same, as my data comes from a Code block, but same concept.

Node input with JS Date transforming

```auto
[
  {
    "Name": "test",
    "Date": "2022-01-01T00:00:00.000Z"
  }
]

```

Output xlsx (relevant cell)  
`<c r="B2" t="str"><v>2022-01-01T00:00:00.000Z</v></c>`

Using JS dates forces it to set an “str” type, which is worse than having the correct value with the wrong format.

---

<div class="post-metadata">

**Author:** ![EmeraldHerald](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/emeraldherald/32/35355_2.png) [@EmeraldHerald](https://community.n8n.io/u/EmeraldHerald)\
**Post date:** [June 12, 2023, 10:44am UTC](https://community.n8n.io/t/date-format-in-spreadsheet-file-write-to-xlsx/27065/4 "2023-06-12T10:44:08Z")

</div>

I’m still not too sure on exactly what you’re trying to do without a workflow @lucabartoli , but at the moment n8n doesn’t have a way to write the xlsx data type. I’m moving this over to the feature request forum - if you can provide as much detail as possible, that would be helpful for our product team 👍

---

<div class="post-metadata">

**Author:** ![lucabartoli](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/lucabartoli/32/4867_2.png) [@lucabartoli](https://community.n8n.io/u/lucabartoli)\
**Post date:** [June 12, 2023, 1:06pm UTC](https://community.n8n.io/t/date-format-in-spreadsheet-file-write-to-xlsx/27065/5 "2023-06-12T13:06:40Z")

</div>

This is a test workflow:

By downloading and opening the spreadsheet, you can easily see that the DateJS cell has the full JS date as a string, while the Date1900 one has a real excel date, just not formatted.

Changing the format in excel after opening produce the following results:

- DateJS: nothing happens, because it is declared as a string
- Date1900: correct date format is applied, but the first format on open is raw value

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/system/32/195824_2.png) [@system](https://community.n8n.io/u/system)\
**Post date:** [September 10, 2023, 1:07pm UTC](https://community.n8n.io/t/date-format-in-spreadsheet-file-write-to-xlsx/27065/6 "2023-09-10T13:07:21Z")

</div>

Closed on September 10, 2023, 1:07pm UTC

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
