A CSV file isn't a spread spreadsheet. It is a text file. Put your introductory strings in separated by commas. You can put something like a # to start a line/comment, if you want. Your interpreter needs to be written to understand it.
-------- Make a text file called text.csv with a text editor and then open it with excel.,,," "
I wrote a PowerBasic program to evaluate 512 cases of a switched resistor matrix, a mess of resistors and 9 SSRs. Some other people can make choices (like, pick their favorite 32 values) so I figured I'd output as a CSV file, which they might like.
If you want to put some explanatory text info blurb on the front you can just do it as is provided that there are no commas in the text. If there are then enclose the thing in double quotes.
A leading single quote ' will act as a comment delimiter for the rest of the line (but beware of commas).
Better control can be had by including all strings in double quotes " and escaping in any double quotes as "".
CSV might not be the most user friendly choice though these days. Tab delimited is one of the Excel defaults and that is much more readable on a dumb terminal. That said I more often see space delimited files.
Having text and column headings in quotes also makes the CSV/tabbed files compatible with the likes of Gnu plot.
---sample of most common forms of text inclusion and mistakes ---
' Full line comment, and contains escaped double quotes "and works OK" "Heading1","heading2","heading3" '
1.2 2.4 5678 or
1.2,2.4,5678,"which would you prefer?" This is plain text on its own "This contains ""quoted"" text" This might not do what you expect, or then it might
--end--
Columns in tab delimited form rather than csv. I find it much easier for browsing data files. Size is the same but readability on a dumb terminal or in notepad or nano greatly enhanced.
One other useful trick is that in most cases ,, can be used as a shorthand for 0, although the cell will be blank rather than 0. (empty cells evaluate to numerical zero). It can be a huge saving in image photon counting files where the majority of cells are zero.
The cells of a spreadsheet are not "normally numeric" they are capable of taking on any value that the computer can represent.
A few lines of text at the top with no commas in will be fine. Your problem arises when something else expects the first line of the file to contains headings in some particular format (eg Gnu plot).
They are extremely powerful tools for mocking up test data and having a quick look see at modest amounts of experimental data.
The best thing about Excel or any other spreadsheet or scratchpad for testing algorithms is that mistakes made in a spreadsheet are completely orthogonal to those made in a procedural programming language.
You also have the oddity of Excel computing in FP and rounding to strictly 15 decimal digits for display. This can sometimes cause annoyance if you are working to machine precision. I have a work around found by trial and error when I noticed an unusual value one day...
An example to demonstrate this behaviour (staring in A1):
column A column B column C
=1-2^ROW() =1-A1 =(1-A1)
And drag them down to row 55
You will see that column B is rounded to 15 decimal digits but column C is full machine precision 53 mantissa. This can be very useful. But it is quite arcane and not so far as I know documented Excel behaviour.
But then MS the help system would define "Help" as "He" the masculine pronoun "LP" obsolete black vinyl music disk now making a comeback.
A MAC is just a long hexadecimal number that is displayed differently. I'm sure it can be done if the sheet software can handle hex. Mine doesn't.
I keep my "list of books" as a database with several related tables. I'm tempted to migrate to an spreadsheet, because, for instance, I can thus carry it in my phone.
Not so much typeless as can be of any valid data type.
The peculiar thing here is that for reasons best known to itself Excel DEC2HEX fails at 2^39 exactly). IOW
=DEC2HEX(2^39-1) works ok and shows 7FFFFFFFFF =DEC2HEX(2^39) fails #NUM!
This is very odd when the standard float type can exactly represent any power of two up to 2^(512+53) and the mantissa of a 64 bit FP can exactly represent all numbers up to 2^54 (there is a hidden in the hardware implicit leading 1 in all non-zero 64 bit FP values).
My pet hate on websites is having to put in a credit card number without the spaces which makes it much easier to have an undetected typo. Groups of four numbers separated by a space are trivial to flash read. It isn't like removing spaces from a string is rocket science!
My other pet hate is collecting UK train tickets where in addition to putting the card that you used to buy the train tickets you also have to enter a high entropy code of 24 characters which does its best to include one of all the ambiguos ones 1,I,l,0,O,5,S etc.
The delays this causes as people fight the stupid robotic ticket dispenser to get their tickets is crazy! Now you can at finally download them to a phone and avoid this queuing mess.
I have seen way too many spreadsheets used as databases causing chaos. It starts out OK with a smallish prototype project and the grows like topsy until one day no-one knows how it works or how to maintain it.
Upto a couple of thousand records it doesn't make much difference either way but go much beyond that and it is "here be dragons" territory.
+1
Spreadsheets are easier for accounting and management types to understand though - DBMS has a much steeper learning curve.
I rely on being able to remember what the cover looks like or now with google and wiki having so much online some key phrase I can recall.
The object being to subtract powers of (1/2)^N from 1 until you hit the machine precision limit. I'd expect all Excel clones to do the same. (otherwise you get subtle errors in spreadsheets on other platforms)
No, I'm not arguing which is better, just that it can be done.
Well, as I don't use Windows I can't have M$ Access, and LO Base is not that good.
Well, my repeats are wasting space in my shelves, I have not been able to gift it. And they are a waste of my money, and a chagrin, not been able to enjoy a reading.
Caveat: they happen to be in English, and few people here enjoy reading books in English.
In fact, I want to donate many old books and I still have not found how/to whom.
Oh, I go to the library to find new tittles that I feel I might enjoy, then buy them online as epubs.
Pet hate: not being able to buy those epubs at the physical library that gave me an hour of pleasure looking around the aisles for new books. It is stupid of them.
Man-Kzin Wars XIV Cibola Burn By: James S. A. Corey Road Rage By: Ruth Rendell Simisola By: Ruth Rendell Sad Cypress (Poirot) By: Agatha Christie The Secret Adversary & And Then There We... By: Agatha Christie Ender's Game By: Orson Scott Card Last Seen Wearing By: Colin Dexter Abaddon's Gate By: James S. A. Corey Caliban's War De: James S. A. Corey Sidi, de Arturo Pérez-Reverte
Kobo is stupid.
When I open their site, they geolocalize me and offer me books in Spanish, despite me only buying from them books in English and having configured my preferences to English.
(Books in Spanish I buy from another provider, local).
There are multiple levels of non-compliance to the Excel de facto standard even in this very simple test. This is what the answer should look like in Excel 2010 which is what I happen to have on the machine I'm using right now. It is exactly the same on XL2021 too.
Note that it should get 2^-49 OK with 15 digit rounding, and it should go right down to full machine precision when there are brackets around the expression. The latter is AFAIK undocumented but useful behaviour.
I don't like what it does to N=50. It clearly can represent 1-2^-50 OK and displays it as different to 1 but then says 1-x == 0. Inconsistent!! I'd have preferred them to put the threshold one factor of two lower. ie. so 8.88e-16 rounds up to 1e-15.
if you have Excel 2021 or 365, then the function to use is TEXTJOIN
formatting link
put your strings in a contiguous range of cells say, A10:X10 in Z10 enter =TEXTJOIN(",", 1, A1:X10)
Oh, if you dont have Excel 2021 or 365, then Google Sheets will work too.
The first line in the CSV file should be the header names of course. Must use database friendly header names, IME. The headers must use consist of only letters, numbers, and the underscore character. Must begin with a letter, typically.
also, check what file format the receiving system needs. e.g., in the databases I work with, it is "MacOS" CSV file format, with UTF-8 encoding -- not Windows default CSV -- (MacOS uses CR as EOL, and CR+LF as EOF).
ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here.
All logos and trade names are the property of their respective owners.