LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

.csv file generated using report generation tool kit gives junk while read as spread sheet.

Hello,

 

I need to generate .csv format reports from a template.xls file. I am doing this using report generation tool kit. Afterwards, I need  to read specific information from these .csv reports later for correlating the information. Since file handling using report generation tool kit is slow, I am trying to read these .csv files using 'read from spread sheet'. but the out put of read from spreadsheet is junk characters.

 

if I open these .csv files and once again manually save them as .csv file, then the read from spreadsheet works fine and gives me the proper characters from required cells.

 

attached is a demo which creates a report from a template (creat_csv.vi) and reads it and displays content (readfromspreadsheet.vi).

 

why is this happening? is there any fix for this?
0 Kudos
Message 1 of 6
(2,636 Views)

The .csv file in your zip file is not actually a .csv file  It is an Excel file with a CSV extension.

 

I can't open your VI's at the moment to see what you are doing, but I do hope you know that Read and Write Spreadsheet File doesn't work with Excel Files.  It only works with text files that are tabulated with delimiters to define columns and rows between data elements.

 

If you are opening the .CSV file in Excel, I'm betting that when you save it, it is saving it as an Excel file format even though you are still giving it a .CSV extension.  Exactly how are you saving the CSV file after you open it in Excel?  Make sure you are doing a Save As CSV rather than XLS

Message 2 of 6
(2,620 Views)

RavensFan is correct.  You are saving an xls file with a csv extension.  That does not make it a CSV.  And the Read From Spreadsheet File does not know how to read xls files.

 

If you want to keep the template setup, you will need to figure out some ActiveX calls to get the values you want out of Excel.  If you want something that only your program is going to read and write, then I say just use the Write To Spreadsheet File with a format that you have programed in.  It will make life a lot simpler.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 3 of 6
(2,589 Views)

@crossrulz wrote:

You are saving an xls file with a csv extension.  That does not make it a CSV.  


You mean renaming a .DOC file to .PDF doesn't make a PDF?  I worked with someone that thought this was how it worked.

Message 4 of 6
(2,576 Views)

@Hooovahh wrote:

@crossrulz wrote:

You are saving an xls file with a csv extension.  That does not make it a CSV.  


You mean renaming a .DOC file to .PDF doesn't make a PDF?  I worked with someone that thought this was how it worked.


<Sarcasm>That's right.  Just changing the extension automatically rearranges all of the bits so that a PDF reader can open the file.<\Sarcasm>Smiley Very Happy


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 5 of 6
(2,571 Views)

Dear All,

 

thanks for the replies. Yeah, the vi which generates the file does that in excel format, even though the extension is .csv. that was the problem.. I can not use spreadsheet function because the file has to be generated from a template.

0 Kudos
Message 6 of 6
(2,462 Views)