excelize
excelize copied to clipboard
Formatting dates format with (*excelize.Rows).Columns
Hello, i have different date format in sheet. It's possible to format dates to one format when i iterating with rows and get rows values with (*excelize.Rows).Columns or i should check every cell for date type and rewrite style for date type cells?
You can create a style with date format by the NewStyle
function at first, you will get a style index, then set the cell's style with style ID by the SetRowStyle
function to change the all cell's styles in a row.
It wiil override all cells in row with number type. In addition to dates, I also have regular numbers in row. This method doesn't fit
If the types of cells in a row are not all date, you need to set the style of the specified cells one by one with the SetCellStyle
function, but you can make these cells use the same style index.
Okay. To set style only for date types cells, i need to check every cell for it's type with GetCellType and then i can use SetCellStyle. But with this case it's consumes a lot of ram (+2gb for 300k rows file and 15 columns). Probably this relates with new reader for every call of GetCellType and SetCellStyle.
So, what I can do with it?
Currently, please set the date type cell style one by one with the SetCellStyle function. I will consider to improve performance for this.