08-14-2024 10:57 AM
I'm trying to use the following to read and write to a specific cell. (In this case write)
my question is there a way to send to a specific cell?
08-14-2024 11:18 AM - edited 08-14-2024 11:20 AM
A CSV file is basically just a very long string with columns delimited by commas and line by linefeeds. In order to replace the values in a specific cell, you need to read the entire file as 2D array, replace the value, then write everything back.
(Only if you can guarantee that each value occupies exactly the same number of bytes, you could calculate an offset into the file and overwrite that location using low-level file IO, but that is fragile.)
08-14-2024 11:31 AM
I think your first suggestion seems doable, give that a try... Thank you
08-14-2024 03:59 PM
Are you sure this is a csv file and not an excel file with a csv extension? The name of the file sure looks like the default name for an excel spreadsheet.
08-15-2024 08:28 AM
Well I have to admit I'm not that proficient in understanding the Excel-.CSV relationship.
Yes I started out with an Excel file and I saved it as a CSV thinking I had to do that in order to use the LabVIEW file functions?
If you could shed some light and set me straight be very appreciative?
08-15-2024 09:47 AM - edited 08-15-2024 09:53 AM
@LED47 wrote:
Well I have to admit I'm not that proficient in understanding the Excel-.CSV relationship.
Yes I started out with an Excel file and I saved it as a CSV thinking I had to do that in order to use the LabVIEW file functions?
LabVIEW supports some Microsoft formats (word excel, etc) with the report generation toolkit. Some of the express file IOs also support various file types.
It is typically much cleaner to write flat delimited text files. Some people actually cheat and give them a fake .xlsx file extension and all that does is force the OS to open it with excel when you later double-click it in the file explorer. Excel is often smart enough to recognize the actual format and read it in correctly. Problems occur you you would then save it in excel format because you would no longer be able to read it inside LabVIEW the same way as before the conversion. (Of course there are ways to make reading excel files easier too! 😄 )