Get Free Trial
Get Free Trial

Export excel with date columns retaining the data type

Sangamesh asked on August 13, 2019

Date source is CSV fetched from API.
API returns date columns in the format dd-MMM-yyyy. Ex: (…,11-Nov-2019,…)
 
How to handle this in flexmonster  UI so that when the drill through report is exported to excel, the date columns will retain their data type as date in excel instead of plain text?
 

3 answers

Public
Vera Didenko Flexmonster August 13, 2019

Hello,
 
Thank you for writing to us.
 
We would like to mention that data representing dates needs to be specified in the ISO 8601 date format.

At the moment, in Flexmonster date fields represented as measures retain their data type as date when exported to Excel.
Here is a JSFiddle example for illustration: https://jsfiddle.net/flexmonster/s48e6jah/
 

Please let us know if this works fine for your use case.
 
Best Regards,
Vera

Public
Sangamesh August 14, 2019

Thanks. As per your example where should i include below code?
data: [
{
“date”:{“type”:”datetime”},
“n”:{“type”:”number”}
},
My implementation is in typescript is as below 
 

public pivotReport: any;
this.pivotReport = {
dataSource: {
dataSourceType: “ocsv”,
filename: Url,
},
slice: {
reportFilters: [],
rows: [],
columns: [],
measures: [
],
drillThrough: []
},
};

 
 

Public
Vera Didenko Flexmonster August 15, 2019

Hello, 
 
 
Thank you for your reply.
 
 
For CSV/OCSV data sources a special prefix needs to be added to the field column name. 
Please see our data types in CSV tutorial for guidance.
The prefixes specify how data should be interpreted by Flexmonster.
 
In case data is fetched from SQL database, we kindly suggest setting the Flexmonster data types prefix dt+ explicitly via SQL query alias.
Here is an example: 

"SELECT segment as 'Segment', post_date as 'dt+Post Date' FROM customers"

 
 
Please let us know if it works for you.
 
 
Best Regards,
Vera

Please login or Register to Submit Answer