02-12-2016 01:20 PM
Hello,
I would like to add a header on my excel spreadsheet, similar to what a report does. I like what I have accomplished so far, so the title block (operator, comments, etc) basically a 1D array of string is what I am missing.
With the flexibility I have to log every so often and writing to an XLSX, I cannot use the write to spreadsheet file VI.
Thanks for your input.
02-12-2016 01:30 PM
02-12-2016 03:16 PM
I might note in passing that streaming data to an XLSX file is extremely inefficient. XLXS files are essentially a ZIP file containing multiple items, including an XML file containing most of the data. To add anything to it, you need to unzip it, add the item, then zip it back up. I would recommend you stream to something else (TDMS, flat binary, ...), then convert to XLSX when done.
02-12-2016 03:25 PM
I have struggled with trying to create this spreadsheet in XLSX format. Do you have any pointers on converting TDMS or binary to XLSX in labview.
Thanks,
02-12-2016 03:46 PM
XLSX is very poorly supported in LabVIEW, only available through the Express VI. If you can, I would write to a standard tab separated text file, then open in Excel and save as XLSX. If you really need XLSX, I would look up the Excel XLSX format and write it myself. You only need a small subset of the format. Doing it yourself means that you only need to zip it back up when you are actually done, so you can be medium fair efficient. As a last option, you can use the .NET interface to call the Excel assemblies and write it using .NET calls. This will require Excel to be present on the system. Unfortunately, there is no easy solution.
Were I to do this, I would probably write to a tab-separated text spreadsheet file, import into Excel, and apply a template for formatting.
02-12-2016 03:48 PM
Use the report generation toolkit. You can send it an Excel file as a template (this can be created an Excel to look just how you like, but leave anywhere that data is supposed to go blank).
02-12-2016 03:53 PM
DGrayStratasys,
My technicians do not like csv or tab separated files. They are requesting XLSX files.
Greg,
I have seen the Microsoft Excel Report VI but it generates and opens the report as soon as the user clicks run, while I want the report to be created at a click of a button, saved to a directory and keep populating with new data and sit there until the user double clicks to open it. Any idea on this?
Thanks
02-12-2016 04:01 PM
Well it all depends on how your program works. I often open an Excel report using "no change" so that it doesn't pop up. If you are generating a lot of data, the best thing would be build the data up in LabVIEW and then write all of it once the user finishes the test. If the tests are long or destructive to the unit, then you will probably want to write to a CSV file during the test so that you don't lose data in case of an error.
02-12-2016 04:06 PM
Ok, i will look into that.
Thank you.
02-13-2016 07:49 AM
@TeamHalli wrote:DGrayStratasys,
My technicians do not like csv or tab separated files. They are requesting XLSX files.
Greg,
I have seen the Microsoft Excel Report VI but it generates and opens the report as soon as the user clicks run, while I want the report to be created at a click of a button, saved to a directory and keep populating with new data and sit there until the user double clicks to open it. Any idea on this?
Thanks
This is easy to do with the Report Generation Toolkit. Assume you are creating a "blank" report, a simple Workbook with a single Worksheet that (for the purpose of this discussion) has data arranged in rows, with the first row having Column Headers and the remaining rows having sets of data that you want to write out, one row at a time. Let us further assume that either (a) all of the data can be represented by a 1D array of Dbl (if all numeric) or a 1D array of String (where you convert mixed type to String). Note that this condition can be relaxed (I write rows based on a Cluster having multiple Types, but it takes additional code).
Bob Schor