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
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
-
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
- Smartsheet Customer Resources
- 63.1K Get Help
- 380 Global Discussions
- 212 Industry Talk
- 444 Announcements
- 4.6K Ideas & Feature Requests
- 140 Brandfolder
- 129 Just for fun
- 130 Community Job Board
- 450 Show & Tell
- 30 Member Spotlight
- 1 SmartStories
- 290 Events
- 35 Webinars
- 7.3K Forum Archives