01-12-2010 01:20 PM
I modified one of the Beginners ActiveX Toolkits provided by Joe_H to enter a number into a spreadsheet using the following code "Save to Existing Spreadsheet.vi". However, since it was originally designed for a .xlsx, it uses an input for the sheet index (which I have set to 1 when using my .csv file). Currently, the program is working, but I was wondering if there is a way to remove the sheet index part. I tried just deleting it, but I could not find how the connections for refnums etc should then work out. Thank you for any advice, even if it is just to say that nothing major should be done.
Solved! Go to Solution.
01-12-2010 01:53 PM
Does it need to be active X? You can use the write to spredsheet vi and that would make things really easy for you.
01-12-2010 01:58 PM
01-12-2010 02:03 PM
You can do that with a write to spredsheet too. You need to change the 2D array before saving.
01-12-2010 02:39 PM
01-12-2010 02:54 PM
01-12-2010 03:11 PM
I will be replacing a blank, single cell with a numeric value. The blank value is created in a header, which I already will have created. The position of this replaced cell will always be constant (say for example it is location A5). Thank you for the effort you are putting in to help me with this issue, I'm sorry if I wasn't clear from the beginning.
01-12-2010 03:41 PM
01-12-2010 04:19 PM
You seem to be fundamentally confusing a .csv file and a .xlsx file. A .csv file is nothing but a text file. A .xlsx is an Excel workbook format. What you are doing with the code you posted is basically having Excel open the .csv file and treat it as a workbook. When you save it, it will still be a text file with a .csv extension. If you want to use Excel to replace specific cells then what that whole mess is what you have to do because that's the Excel object model.
I think that the Write to Spreadsheet File will be far easier. You do not need to read in the whole file if you just want to append values. The Write to Spreadsheet File has an "append to file" input. All that this does is simply move the file pointer to the end of the file.