-
Notifications
You must be signed in to change notification settings - Fork 400
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
Retaining Excel Formatting #164
Comments
Is it possible you could post a sample xlsx? Exporting numbers with leading zeros is not supported, have not found a reasonable work around for this yet. The date issue sounds likely. Need to investigate. |
I have a similar issue - I noticed this when I had inconsistent date formatting in Excel in the date field. XLSX file - date column has 2 different date formats Import-Excel does not work as expected - the date column shows the serial date format for one of them $test = Import-Excel test.xlsx
$test | ft CSV or txt export from excel - this works as expected - the date column shows the date formated |
Thanks for posting the issue. I changed |
I am also having this issue, specifically with dates. I wonder if this is doing math on the date? Even if I have to modify the format on the Excel sheet itself any workaround would be awesome. |
Excel does not store dates as such. It stores a number which is the number of days since Jan 1 1900, There are 50 preset number formats - sometimes when you select a date format you are setting a format in the form "dddd dd mmmm yy" sometimes you are setting "Preset format 14" . These presets allow excel to format as mm/dd/yy when the sheet is presented to someone with US regional settings and show the same sheet as dd/mm/yy everywhere else. Now : in the EPPlus library that we use they have to decide when to turn a number into a date. The logic is here
So if the number is formatted with styles 14..22 , 45,46 or 47 it will be a date; otherwise it will be a number
The long date and time on the quick menu and their equivalent * entries correspond to entries on at the bottom of the custom menu |
Would it be possible to create a parameter to import the Text instead of Value? This works perfectly for me, but my workaround now is to create the function myself with .Value changed to .Text, so I can't use the module as it's supposed to. |
@kaeon |
I am pretty new to Powershell scripting but have used this module to complete many small projects. So thanks for that.
I am having some problems and am not sure if this is a bug or not understanding how cell formatting should be applied.
The scenario is we have a number of XLSX files that need to be parsed for a particular column, group by that column and then save to a file with only that particular columns data in a stamped folder. There is two particular problems happening and I am not sure how to deal with them.
I have tried a number of things to alleviate this but nothing seems to work. These are probably the most relevant attempts.
Here is the script:
As I mentioned, I am an inspiring Powershell programmer so I might have missed something obvious but I do appreciate your work on this module and any help you may have.
Thanks,
The text was updated successfully, but these errors were encountered: