Reading from Excel gives ####### in some columns - powershell

I am using powershell to read data from a .xls file. All goes well, no need to display the code. But I have an issue that I have no idea how to solve.
Some columns in the excel are not wide enough to display their data:
In reality:
2016.04.01
As the column is displayed when opening the file:
########
When I am reading from the excel, the cell content I get in powershell is actually ########, not the actual cell content (= a date in this case).
I am reading 1000's of Excel files, all with the same issue. How can I fix this in my code? Is there a flag I need to set that I don't know about?
Any help would be much appreciated!

Related

how can read text data from excel in matlab?

i want to read text and numbers from an excel file. when i write the code as below it can not read the text data from excel file. how can i fix it? thank for taking your time.
data = xlsread('normalize.xlsx');
the picture of excel file is here:
and the picture of data that created from the code is hear:
'xlsread' and 'csvread' are both for reading numeric data in MATLAB. If you are on a Windows platform and have Microsoft Excel installed, you can use the following syntax with 'xlsread' to read your data into two cell arrays:
[num_data string_data] = xlsread('normalize.xlsx');
You will have the text column in your data in the string_data array. The corresponding column in num_data will still have NAN.

Find corrupt data in xlsx file

We are generating xlsx files using a perl script. Files usually contains thousands of records. This makes spotting errors a very difficult operation.
This process was working since years without problems.
This week we got a request to check a file which contains errors. While opening Excel prompted that the file contains errors and asked whether we want to repair them.
In fact we do not want to recover the data but want to know which part of the file is corrupt. The error should be coming from corrupt data and we are interested to identify these data.
the log message shows the following:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<recoveryLog xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
<logFileName>error068200_01.xml</logFileName> </br>
<summary>Errors were detected in file 'D:\Temp\20161020\file_name.xlsx'</summary>
<repairedRecords summary="Following is a list of repairs:"><repairedRecord>Repaired Records: Cell information from /xl/worksheets/sheet1.xml part</repairedRecord>
</repairedRecords>
</recoveryLog>
The error should come from corrupt data. Is there any tool/method which helps to spot this corrupt data?
I tried renaming it a zip file, extracting it and opening it via an XML editor but was not able to find any errors in XML file.
We also checked that the different XML file structures are fine.
Thank you and best regards
As expected, the problem was coming from text cells containing numbers having an E in the middle.I used the following steps to identify the erronous cells.
1. Wrote small Java class to read the file. The class was checking the cell type and displaying the value afterwards.The java program generated an Exception at some line "Cannot get a numeric value from a text cell" even If I was correctly checking the cell type before displaying the content.
2. I checked the opened Excel file at that line and found that the cell contains only 'inf'.
3. I opened the file using open office and looked at the same cells. They contain 0.
4. I debugged the program generating the data and found out that these cells contain data like '914E5514'. Seems that E which was interpreted by Excel as an exponent.We changed the program to use the format '#' for that cell and this solved the issue.
Thank you.
Thank you very much, you helped me a lot by saying that 1 particular content item may be the root problem.
My corrupted content was https://www.example.com XYZ ... ASDAS
Solution: www.example.com XYZ ... ASDAS
This is something which cannot be handled by excel. Would be nice to have a list of thing which do not work

matlab lose response when use xlsread reading a large spreadsheet

I am trying to use xlsread functioin to read spreadsheets of 6000x2700 (xlsx file).
I have two questions:
First, when I use something like
[num,txt,~]=xlsread(input_file,input_sheet,'A1:CYY6596')
Matlab keeps showing 'busy' and lose response (while I can open it in excel within 30 seconds).
Is there any solution If I don't want to loop through ranges of the xlsx file? In other word, can I just dump spreadsheet of this size into matlab using xlsread?
Alternatively, Maybe I can use loops to read these files range by range, but I cannot identify the last column of each of the spreadsheets unless I read the whole file first. Therefore, If I cannot identify the last column, it is hard to make loops and do my interpretation on the file.
So My second questions is: Is there a way to identify the last column of the spreadsheet without reading the whole spreadsheet?
Thanks.
EDIT:However, if I run a similar code which only reads first 400 columns ('A1:RY6596') of the spreadsheet, such problem doesn't happen.
which version of matlab you are using?
matlab has a problem to load bix excell file.
convert the excell in csv and use M = csvread(filename).
You can try to convert .xlsx into .xls also.
You can Try the tool in
File Exchange

Best way to get a database friendly list of Veteran Affairs Hospital

I sincerely apologize if this isn't the proper forum to discuss this, but I wasn't sure where to go or what would be the best option.
Basically, I'm trying to find a database friendly list of veteran affairs hospitals. The closest thing that I've been able to find is www.va.gov/ofcadmin/docs/CATB.pdf as it has all the information I'm looking for:
Region
Address
City in a separate column
Zip Code in a separate column
State
Facility # (also known as StationID)
VISN
Symbol
I've tried exporting that PDF out into CSV but it's a complete nightmare to get working. So, I was curious if anyone had any ideas or insights into how I could accomplish this task.
First, here's a CSV file containing the data found in CATB.pdf. The very first line contains the column headers, and the rest of the file contains the contents.
http://tmp.alexloney.com/CATB.csv
Now, for the more detailed explanation...I took the PDF you provided a link to, converted it to an HTML document using Adobe Acrobat, then I used a lot of Regular Expressions to parse the file and clean it up. Once the file was cleaned up enough, I was able to write a program to parse through the remainder of the file, grab the state and region, and spit it all out in a nicely formatted CSV.
Hope that helps you!
I believe that PDFILL has an option in it that will convert a PDF file to Excell. Once in Excell you should have no problem converting to a CSV file.

Create PDF from CSV on iPhone

An iPhone app which I am creating generates reports from a Core Data database as a CSV file, which can then be emailed so that the user may use that data elsewhere outside of the app. I would also like to offer the ability to generate the same reports as a PDF file (of course, with nicer formatting) allowing the user to immediately print the report rather than having to jump through several hoops as with the CSV file - i.e. open in another application (e.g. Excel, Numbers) then reformat the columns (so they are wide enough for printing), bold the headings, etc.
Essentially, I want to provide the PDF file so that the user is immediately given a nicely formatted report, and they only need to export the CSV file if they wish to do data manipulation and need a format which is editable.
I was thinking that the easiest method would be taking the CSV file and the converting this into a PDF file, which would be the same as the CSV except would incorporate nicer formatting (such as a tabular layout) rather than the simple comma-separated format of the CSV file. I have been unable to find any ready-made classes for this purpose (to avoid reinventing the wheel) and I am unsure how to approach this since I have limited experience with this aspect of the SDK. Any suggestions or pointers in the right direction would be much appreciated.
You have two different problems:
Read CSV data into some structure in memory
Turn some structure in memory into a PDF
Aaron Saunders has posted some links for step 2, so here's a link for step 1:
http://github.com/davedelong/CHCSVParser
That's a CSV parser I wrote that will turn your CSV file into an NSArray of NSArrays of NSStrings.