Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Storing data in excel as date format when downloading excel file #20

Open
vidyashviram opened this issue Dec 3, 2018 · 1 comment
Open

Comments

@vidyashviram
Copy link

vidyashviram commented Dec 3, 2018

Hi,
I want to store value for a particular column in date format.

Below is the column in my workbook:
<Workbook.Column label="lastUpdatedDate" value="lastUpdatedDate" />

How can I store this 'LastUpdatedDate' as date value when we download the excel file?
The values are getting stored as text.The column values should come as 'date' instead of 'general' so that we can sort according to dates for that column.
Thanks

@vidyashviram vidyashviram changed the title Storing data in excel as date format when downloading excel filr Storing data in excel as date format when downloading excel file Dec 3, 2018
@tgoyer
Copy link

tgoyer commented Mar 22, 2019

I used this to build dynamic Excel exports that had arbitrary columns.

{Data != null && ( <Workbook filename={Data.Name + " Export.xlsx"} element={ <Button color="primary" className={classes.subHeaderButton}> <i className="far fa-file-excel"></i> Excel Data Export </Button> }> <Workbook.Sheet data={formatExcelData(Data)} name={Data.Name}> {getExcelColumnMap().map(d => <Workbook.Column key={d.index} value={d.key} label={d.value} />)} </Workbook.Sheet> </Workbook> )}

getExcelColumnMap generated the list of columns and formatExcelData took care of Boolean/Date/Number/Currency/etc formatting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants