I am trying to export some data to Excel via SQL-Server SSIS.
Everything works so far, but the data in Excel are not recognized as a date or decimal number, so that the user of the sheet first has to laboriously reformat.
Is there a way to export the data directly so that the correct format is recognized?
I select the data via OLE-DB-Source from a SQL-Server 2014 and than I do a data conversion to map the fields to the data formats of SSIS:
VARCHAR to DT_WSTR,
DECIMAL to DT_R8,
DATE to DT_DATE
Finally I use the excel-Export task to create a xlsx-File dynamically.
That works but I want that the data are in the format that the user of the Excel can directly filter and summarizing the data. That doesn't work.
Related
I am exporting reports as XLS files from Salesforce. These reports have dates that I want to be able to manipulate in Excel but... Excel doesn't recognize them as dates.
The format outputted by Salesforce right now is m/d/yyyy (ie: 8/18/2022). When I go in Excel and change the format to date... the data is not recognized as a date.
It seems the only thing that Excel can consume are dates configured as yyyy-mm-dd.
I tried to play with Excel formatting date form with no luck.Excel doesn't recognize the Salesforce format, or does not propose anything similar to it
Is there a setting in Salesforce or in Excel that I need to adjust so that both apps can generate, and digest the same date configs?
I want to run these reports weekly so whatever requires the less Excel gymnastic will be the best solution (Google Docs for instance recognize dates as Salesforce spits them... - but I can't use GDocs at work).
You should use PowerQuery to import the data to Excel.
In PowerQuery change the Column-Type USING LOCAL
Select Date and English (United States)
Voila!
I have a excel file that automatically imports data from an Oracle DB into the sheet. Everything works fine, but date formatting is wrong. In the Oracle DB, the format is 01-JAN-2016. But when it exports to Excel, the format suddenly changes to 1/1/2016.
Is there a good solution to this? Setting the cell format beforehand doesn't work. Once the data is imported, Excel automatically switches format to Date. I have tried a lot but can not solve this issue so I am wondering if any of you have ideas as to what to do. Thanks.
The date isn't stored in "01-JAN-2016" format, that's just a representation of the underlying date value.
The recordset contains the data, not its representation. Format the column with a NumberFormat like dd-mmm-yyyy, and 2016/01/01 will look like 01-JAN-2016.
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
Regarding datetime values, is there an encoding that I can select from
SQL Developer that when I export to Excel it is formatted as datetime?.
I tried UTF-8 & UTF8. What appeared was,
01/01/85 12:00:00.000000000 AM
This isn't filterable from the filter drop down in excel.
In Microsoft's SSMS, I could select ANSI and the datetimes values would appear fine.
But SQL Developer doesn't seem to have this option (ANSI).
Current work around that I do is to extract in Excel the value into another column with the date formulas (date, year, month, day).
Edit
Exporting as datetime that excel can interpret, oracle can actually do it as well.
But it must be exported as csv.
It is the same for Microsoft's SSMS.
The oracle excel export that I was using had results that were in 1 sheet and the sql executed in the another.
No, we don't format the cells when we create the Excel file. You'll need to do that in Excel when you open it.
I have a DIM Date dimension in my cube that has a date column whose type in SQL datamart is "date" and the data type in cube for this arribute is set to "date". But when I query the cube from excel and tableau, this arribute shows up as string instead of date and so I don't get the natural hierarchy of year ->month -> date in the client tools. Both excel and tableau format this column correctly if I connect directly to datamart instead of a cube.
Is there any trick or tip to make these client tools format the date column as datetime instead of string ?
I don't want to manually create these hierarchies in the cubes because there are 60+ date columns in my cube across all dimensions
Thanks
In Tableau, you can change the field type to date and then save the data source as a reusable tds file. The settings should then be retained
From http://www.theinformationlab.co.uk/2013/12/02/tableau-file-types-and-extensions/ :
Tableau Datasource (.tds)
When you connect to your data for the fist time, you may have a little bit of data ‘modelling’ to do – setting the right data types, changing default aggregations, setting default colours, creating some custom calculated fields etc etc. You are giving Tableau information about the data you will be using – you are setting up its ‘metadata’. When you want to connect to this data again, you don’t want to really go through all this data modelling a second time so instead you can save your metadata as a .tds file (again, it is saved in XML format) and connect to your data though this file instead. You could also distribute this file so that your colleagues have access to the nice formatting and custom fields you have worked to set up.
Tableau is clever enough to pick up new columns/fields in the data source if they appear and column ordering does not matter but if column names change or disappear completely, you will need to reconfigure.
To create a .tds file, from Tableau Desktop, right click on your data source connection and select Add to Saved Data Sources. Alternatively you can publish the .tds to Tableau Server by right clicking and selecting Publish to Server instead