11-03-2013 04:51 AM - edited 11-03-2013 04:53 AM
I want to write string data into an Excel file in the following manner
thanks
11-03-2013 11:31 AM
11-04-2013 08:02 AM
If you would like an actual Excel file (*.xlsx) and have a new enough version of LabVIEW (2013 or higher), you can use the Write to Measurement File express VI and select the Excel file output option. If you would like headers on your columns, you can set these using the Set Dynamic Data Attributes express VI before wiring the data to the write VI.
11-05-2013 07:43 AM
... and if you have the Report Generation Toolkit, you can do lots of "fancy stuff" with Excel, including making plots and formatting your Workbook.
11-05-2013 08:42 AM
@DFGray wrote:
If you would like an actual Excel file (*.xlsx) and have a new enough version of LabVIEW (2013 or higher), you can use the Write to Measurement File express VI and select the Excel file output option. If you would like headers on your columns, you can set these using the Set Dynamic Data Attributes express VI before wiring the data to the write VI.
Wow this is quite interesting. Opening the Express VI gets a little crazy but it appears that NI is making this xlsx file without using Excel, and just writing to the text file using the standard XML format that Excel accepts. Very cool. In the past I have always created a TDMS file, then used ActiveX and Excel to convert from TDMS to XLSX. This has its benefits but takes time at the end for the conversion.
It would be really cool if NI cleaned up the Excel writing code a bit and made it an official API for creating/editing Excel files without ActiveX.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
11-05-2013 09:38 AM
Thanks but still hav not got propr solution, i m using Labview 2009 and also used write to excel block but didn't got the desire output as i hav attached image above.. just tell me how to separate each line from string.
11-05-2013 09:44 AM
11-05-2013 10:05 AM
Hooovahh wrote:
It would be really cool if NI cleaned up the Excel writing code a bit and made it an official API for creating/editing Excel files without ActiveX.
I believe there is a suggestion on the Idea Exchange to that effect. Please kudo it. Making it an official API is somewhat challenging because XLSX files are compressed. To add or modify them, you need to uncompress to a temp location, modify, then recompress. This makes streaming to an XLSX file a challenge. It also accounts for the time hit when the file is closed - it has to be recompressed. An API would allow the user to explicitly do the uncompress and recompress, making streaming much easier.
For the original question, if you don't mind a text file, open a text file and write each line, including the header, using tabs as separators between the columns. You have both string and numeric data, so you cannot use the standard array to spreadsheet string VI or the write to spreadsheet VI (at least not easily).
11-06-2013 11:00 AM
Thanks GerdW,
yes, I have done this to take separate string data and take it to BuildArray block for 1d data (vertical arrangement) then again to BuildArray block to get 2d date (horizontally) and then simply write that to Excel using WriteToExcel... But now I don't have separate string data... So how to split my this string data???
Thanks,
Regards
Salman Abid
11-06-2013 05:47 PM
Hello Salamabid,
Have you tried using a Build Array.vi for each string you want to enter and then inputting that information into an Array To Spreadsheet String.vi?
Take a look at the attached example. The data may not be entered in a way that you want but you can use the String Subset.vi and other string manipulation VIs to format the strings the way you want.