I am trying to automate the importing of a county file and convert it to csv. The issue I am having is that the account number is getting converted to scientific notation.
Import-Excel BacktaxRaw_FL_Flagler2.xlsx | Export-Csv ExportTest.csv
If I tried formatting number fields to be text fields using
C:\testdata> Import-Excel BacktaxRaw_FL_Flagler.xlsx | Export-Excel ExportTest.xlsx -Show -AutoSize -NumberFormat '@'
The problem here is that the account number last few digits are replaced with Zero. Example. The original number is ''1914310000010100016", Import is converting it to "1.9143100000101E+18 and finally the export is getting converted to "1914310000010100000". As you can see the 16 at the end is replaced with 00.
Ironically if I import the data into a new excel file and specify importing the data through excel and define the type as text then I can use Import-excel to convert to csv with no issue. This is telling me that Import-Excel is struggling to import the data from the original excel file. Can someone help me with this issue please?
I have attached the import file: BacktaxRaw_FL_Flagler.xlsx
After doing some research and thanks to Ron's suggestions, I did a deeper dive to view the raw source code of the above file. I unzipped the contents of the BacktaxRaw_FL_Flagler.xlsx file and navigated to the \xl\worksheets\sheet1.xml file. I opened in notepad and saw first hand that none of the values I am looking for in column A are stored in scientific notation. They are in deed stored uncorrupted. Which means every attempt I have made to retrieve the data has resulted in data corruption. Even using Excels own data import wizard will alter the values.
Screen shot So you don't need to download file
If you want, download the raw xml file here: Raw XML file

1914310000010100016. The numeric values in the Account Number column have already been converted to their numeric values. See Rows 3,23,25,28,30 and higher. - Ron Rosenfeld