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

  • Genevieve P.
    Genevieve P. Employee
    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