Excel adding double-quotes to a TSV file - excel

I'm working on a system that primarily uses TSV files for internal exports, and many of the users who interact with the files only currently use Excel.
I've noticed lately that if a cell contains a comma character: when the TSV is downloaded that cell looks fine, but then if the document is opened, changed in any way and then is closed again: then quote characters are being added around that cell.
So if the file contained the text !house, pm and then the file was in any way amended and saved: that cell would now contain "!house, pm"
Re-importing with the " characters is causing errors all over the place.
Couple Q's:
Is there a way to stop Excel from adding these "" characters?
If not: is there a better program to be using to amend this doc, with similar functionality and format to Excel (especially for non-technical users)? So like a row+column layout, ability to filter, etc?

Libre office does not have this issue.

Related

What is the simplest Excel file format with formatting included

I create .CSV files by building the content like this:
s= "column1, column2, column3 \r\n"
s+= "R2column1, R2column2, R2column3 \r\n"
saveas("file.csv", s);
I now need to include a way to resize the columns when viewed in Excel.
I've read that CSV cannot do this, so what is the next simplest excel file format that can? And how would new syntax look?
CSV files are simple text files that contain plain data.
You can open these files in Excel, and it will be displayed in the spreadsheet view for convenience, with each field separated by the separator (in your case the ,) in a separate cell.
Although you can change the width of an Excel column, this is purely a visual style in Excel and can only be saved in an Excel file.
The solution would therefore be to convert your CSV files to Excel (*.xlsx) files.
Depending on the language you use you can probably directly create Excel files, without the need for conversion. There are libraries available for most programming languages for exactly that purpose.
If you want to create Excel files with Android, this might help: How to create an excel file in android?

Generating file which can Excel easily open and save

i am exporting data from database to file, which can Excel read and save.
(CSV) I generate csv, with default format (according to RFC 4180, comma delimeter). As expected, stupid excel read all data and place it to one cell.
(CSV with semicolon delimeter), this one excel read fine, but after change some value and press save (CTRL+S), stupid excel saved it to unreadable file (well done!). No delimeters, no string separators. Ok, so i tried to save it as (CSV format with SEMICOLON delimeter), saved file looks ok, but after opening it with excel, error message was showed - INCORRECT FORMAT - no cell found :D really?!
Generating .xsl file in php. It take too much RAM (about 2GB), so it cant be used.
Do you know any good format, which can excel easily open and easily save?
Thanks a lot!
This question is off-topic, but IMHO Excel 2002/2003 XML Format would be the best choice in your circumstances.
The reason for this is that the data in this format is typed - so you will not see numbers misinterpreted as dates, or phone numbers with leading zeros stripped. I am not aware of the kind of problems you describe, so I cannot say for sure how those will be affected.

Opening CSV file

I am generating CSV files. My first row it is column names, and it looks like
User ID;First Name;Last Name;Email;...
But if I will change User ID to ID, MS office cannot open this CSV and shows me error
Cannot read record(number of record)
But this file opens correctly on, Notepad++. I am using Excel 2013. Any ideas what is wrong?
You can solve the problem by inserting the following simple text at the beginning (the first line) of your .csv file:
sep=;
This will not be seen when the file is opened in Excel. What it will do - it will explicitly tell Excel that the delimiter is ;, and values will be separated into separate cells. Also, you will be able to use ID as the title of a column. Unfortunately, I cannot answer why Excel does not like it when you use this title at the beginning of the file.

writing csv to open as different tabs in Excel

Is there some way to write a csv file such that , when opened in MS Excel , it will open in different tabs in the workspace ?
The short answer is, NO.
For that matter, the long answer is NO too.
csv is a continuous run of lines of values separated by commas. each line doesn't even have to have the same number of values etc. there's no concept of workbooks or different "areas" in csv. Excel cannot be cajoled into opening a csv into multiple workbooks...well at least not without writing VBA to parse the csv file yourself.
the oxml or whatever they've ended up calling the xml file spec for office, allows workbooks and is still easy to deal with being text based. Do you have to use csv or can you switch (at least part way through) to xml?

Exporting .xls to .csv issues

I have been trying to import this excel file my mysql database, and it has been rough.
There are around 7,000 rows in the .xls file, but when I export it to .csv and parse it with PHP I get one of two issues:
Excel does not escape anything, ie. the commas in each row split the data
When I change all commas to * then export for some reason excel changes a whole bunch of lines to a bunch of pound signs #####.
(Is there a reason it does this?)
I can upload the .xls somewhere if need be.
As a suggestion, if you are dealing with cells that do contain commas which are widespread, an easy solution would be to export from Excel in a Tab-Delimited format (TXT), or yet alone any format that contains a character you would not normally encounter.
I've found it to be a pretty simple way to take care of many of the troubles associated with exporting from Excel and importing into a database medium.
Figured it out!
Turns out it was Excel's fault. I checked the .xls before opening it in Excel, not ###.
But after saving it in Excel they appeared.
So I opened it in Numbers (part of iWork), changed all , to *, and all quotes to % (these never appeared in any line. Exported it to .csv, then changed them back when importing with PHP.
Worked great. :-)

Resources