Exporting dates as dates - apache-poi

We're currently using JMesa on a project to show HTML tables and exporting this data to Excel files.
For date columns we use this:
Column date = new Column("source.date").cellEditor(new DateCellEditor(DateUtil.DD_MM_YYYY));
However, this exports that data as text, which results in our users not being able to sort this column correctly in Excel. Is there a possiblity to tell JMesa to format this column as a date ?
Also, is it possible to tell JMesa to automatically set the width of the columns (it's possible in POI).
We're currently using JMesa 3.0.0

Related

Excel problem: Exported from OBIEE to Excel analysis adding time part to a date column

There is a date column used in OBIEE analysis. That column is declared as 'date' datatype in Oracle table, type in rpd is also 'DATE'. However, when exported to Excel, Excel is adding time values to the end of date part of this column. Here is a simple analysis:
The same analysis when exported into Excel:
As you can see, it is adding '5:00:00' to the end of '11.05.2022'. My guess is it is adding timezone values by default, which is the following in our OBIEE:
How can we prevent Excel from adding unnecessary values? Should we change settings in instanceconfig.xml file to use formatted value using 'UseFormattedValue' parameter? Or is there any simpler way to do this?
UseFormattedValue is the way to go because your problem isn't the Oracle side, but rather Microsoft trying to be "smart" in their interpretation in Excel.
https://docs.oracle.com/middleware/bi12214/biee/BIESG/GUID-FF6954BA-2DE0-4422-BA58-05F32936F4FF.htm#BIESG9196

Dynamically Creating Excel table through SSIS

Using Execute SQL Task in SSIS - created Excel file- contains multiple columns and different data types.The issue here is INT/Money columns are displaying as a text columns in Excel even though excel table is created with Int/Money datatype
I have tried to used double precision,CY datatypes but nothing worked out.
CREATE TABLE `Employer` (
`MEMBERSHIP NUMBER` VARCHAR(30),
`RETIREE #` VARCHAR(12),
`COPID` CHAR(6),
`PERSON LAST NAME` VARCHAR(150),
`FIRST NAME` VARCHAR(150),
`RETIREE PLAN` CHAR(15),
`PLAN NAME` CHAR(200),
`BILL GROUP` INT,
`BRANCH ID` CHAR(3),
`CONTRACT NUMBER` CHAR(5),
`PBP` CHAR(3),
`BRANCH NAME` VARCHAR(150),
`COVERAGE MONTH` DATE,
`DUE AMOUNT` INT
)
Expected output should be in input datatype format.
OLE DB data types and Excel
Even if you can create Tables in Excel using OLE DB commands, excel files are not databases, where columns have data types. The OLE DB provider read only tabular data and need to specify a data type for each column. For this reason, you must specify columns data types when handling Excel, even if excel has the ability of storing multiple data types within the same column.
One of the disadvantages of using OLE DB provider to read Excel is that if a column contains mixed data types, it only reads the dominant data types and convert all remaining data types to NULL.
Importing data from Excel having Mixed Data Types in a column (SSIS)
Mixed data types in Excel column
Excel Number Format property
On the other hand there are a Cell property in excel called Number Format which is used to change the way values are shown in Excel. You can use this property to show values as Currency.
Format numbers as currency
HOW TO DISPLAY NUMBERS IN EXCEL 2010 AS CURRENCY
Solution
You can use two approaches to solve the issue:
(1) Changes Column Number Format using Script Task
You can add a Script Task and change the entire column Number Format using Interop.Excel.dll assembly.
Format an Excel column (or cell) as Text in C#?
Format Entire Excel Column Using C#
(2) Create an Excel template file
You can create an Excel file and change the columns Number Format as needed and use this file as template. You can copy the file the the destination directory, then perform data import phase.
Quick Start: Format numbers in a worksheet

Monitor change of tables in excel by adding date and time

I have an Excel sheet contains some tables that I have used format as table option in Excel.
Now I want to monitor the change in value of each table by adding the date and time on top of each table.
Please help me with this,
Thanks!

Excel to Access date error in formatting

I am having an issue with a program. The macro in Access imports an Excel file, then it appends an already created table with the imported data, and runs a check after to make sure that the table was appended correctly.
I have tried for hours to figure out why my imported tables are not being appended. I know that this is a formatting issue. There are six columns in my Excel table. The first three columns have Text Data Type. The fourth has Number Data Type. These are fine since the field properties match exactly for the imported table and the already existing table.
So my issue is with the last two columns. The last two columns in the existing table in Access have Date/Time Data Type. The format of these columns as shown in Field Properties is m/d/yy;# (I'm not sure what this means and an explanation of this might be helpful)
The imported table has Date/Time Data Type with format m/d/yyyy. I have tried changing the format in Excel to m/d/yy and m/d/yy;#. Both of which got the format to show correctly in Excel, just as it does in Access for the correct table. But when I import it does not keep this formatting.
The check does not register the rows with new dates and the table does not get appended. I am looking for an easy fix in Excel to change my data's formatting as there are 17 separate macros that I have to run each month.

dataTime datatype converted to string in importing excel file to protege using Celfie Plugin,

I am working on Protege 5.0 with the plugin Celfie. I have imported an excel sheet which has a column Start_Time (datatype dateTime). When i import the excel sheet into protege, it converts the rows from dateTime format to a string or some other data type. I want to use that column for a data property having the data type DateTime.
I have attached screenshots of both my excel sheet and the celfie tab. Any help would be appreciated.
Celfie Plugin Tab snapshot
Excel Sheet snapshot
The issue is actually a formatting issue in Protege. In Excel, date times are stored as floats, with the integer representing the date and the decimals representing the time.
39448 is 01/01/2008 (https://support.office.com/en-us/article/DATEVALUE-function-df8b07d4-7761-4a93-bc33-b7471bbff252); since the results you're getting in Protege are similar, those seem to be the raw date time values.
You need to convert them in Protege, either by using an informat when you pull them from Excel, or by formatting them in Protege in the same manner that Excel would.

Resources