08-23-2022 04:15 PM
08-23-2022 05:00 PM
Whenever you use the array to spreadsheet string function, it adds a newline as the ending character, you can remove this by using a trim whitespace after the array to spreadsheet string function.
08-23-2022 08:18 PM
A spreadsheet is a two-dimensional Data Structure, designed to be "human-readable", hence the data are represented by strings (typically encoding numeric data). To define the "two dimensions", a character needs to be "reserved" for the "column separator", and a different character "reserved" for the row (or "line") separator.
The most "natural" way to separate "lines to text" (= "rows of a spreadsheet") is with the <EOL> (end-of-line) character(s), which can be <CR>, <CR><LF>, or <LF> (depending on various things, such as Windows, Mac, Linux, etc.). The two most common column separators are <tab> (the LabVIEW and Excel default), and the comma (",") -- the latter type of file is sometimes called a "Comma-separated Values" file, and might be given the extension ".csv". However, Microsoft has "hijacked" this extension in Windows by creating an Icon for this file type that looks very much like the icon for the Excel ".xls" and ".xlsx" file types, leading LabVIEW users asking "How can I read/write Excel files" and confusing "delimited Spreadsheets" (text files) and native Excel (.xlsx) files.
It sounds like you might have a system where <EOL> is, perhaps, <CR><LF>, and you have a file with "extra" <CR> or <LF> characters. If so, your file has "bad characters" in the file that might confuse the Delimited Spreadsheet reader -- you can "fix this" by simply reading your file one (entire) line at a time, looking at the next character, and if it is another <CR> or <LF>, deciding if it is "real" (for example, a "blank line") or "garbage" (such as the sequence <CR><LF><LF>, which you can fix by discarding the "bad" character.
Bob Schor
08-23-2022 10:51 PM
@Hepcat wrote:
I'm writing a tab delimited spreadsheet and also reading it back elsewhere in the program. Some of the data has new lines in it. The read spreadsheet is treating the newline as a delimiter as well. Is there any way to stop this?
Since you are writing the tab delimited spreadsheet, you have full control over the format. If you would attach some simplified code, we could probably tell you where the problem is without wildly guessing.
Once we see a simplified version of your code (writing and reading sections), we can provide more feedback.
08-24-2022 09:56 AM
08-24-2022 10:08 AM - edited 08-24-2022 10:10 AM
@Hepcat wrote:
I'm just going to open it as text and search for the tabs in a loop and output the array that way. Thanks everyone.
So that probably means that you only have a 1D array.
If you use "spreadsheet string to array" and use a 1D array as type, the newlines are no longer special. No loop or searching needed.