Downloading a sheet as a CSV converts the dates to MM/DD/YY
I'm downloading a sheet as a CSV, manipulating some data, and creating new spreadsheets out of that data.
Everything works until I try to upload a date that I'm downloading from smartsheets.
In the smartsheet the date looks like this:
However when I use the node SDK I get this:
var options = { id: spreadSheetID }; smartsheet.sheets.getSheetAsCSV(options).then(result => { console.log(result); } "Available_Date" "04/05/22" "04/12/22"
I know that I need to upload the dates in the YYYY-MM-DD format. So why does the API return them in the wrong format when exporting as a CSV?
Best Answer
-
Hi @charlie_wt
The format of the date that you're seeing in the sheet in Smartsheet is a display value specific to that sheet, however the underlying data will be based on your account's Personal Settings under Regional Preferences.
This is the date format that the API will pull when exporting a sheet for date columns, regardless of the sheet-specific display formatting. Exporting the sheet directly from the UI will provide the same experience: dates are exported in the format set in your Regional Preferences.
Cheers,
Genevieve
Need more help? 👀 | Help and Learning Center
こんにちは (Konnichiwa), Hallo, Hola, Bonjour, Olá, Ciao! 👋 | Global Discussions
Answers
-
Hi @charlie_wt
The format of the date that you're seeing in the sheet in Smartsheet is a display value specific to that sheet, however the underlying data will be based on your account's Personal Settings under Regional Preferences.
This is the date format that the API will pull when exporting a sheet for date columns, regardless of the sheet-specific display formatting. Exporting the sheet directly from the UI will provide the same experience: dates are exported in the format set in your Regional Preferences.
Cheers,
Genevieve
Need more help? 👀 | Help and Learning Center
こんにちは (Konnichiwa), Hallo, Hola, Bonjour, Olá, Ciao! 👋 | Global Discussions
-
This is very helpful, in the future though I think there should be an option to pass in the format of the dates so that they can be re-uploaded easier. It makes it hard to share scripts if you can't predict the date format either.
Categories
- All Categories
- 14 Welcome to the Community
- Customer Resources
- 64.9K Get Help
- 441 Global Discussions
- 139 Industry Talk
- 472 Announcements
- 4.9K Ideas & Feature Requests
- 129 Brandfolder
- 148 Just for fun
- 68 Community Job Board
- 496 Show & Tell
- 33 Member Spotlight
- 2 SmartStories
- 300 Events
- 36 Webinars
- 7.3K Forum Archives