Generating file which can Excel easily open and save - excel

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.

Related

Save Positive Numbers in parentheses in csv

I want to save the positive numbers in parentheses in .csv. For example:
My number = (0.235)
When I try to use number format, it automatically converts this number to -0.235. I changed the format, use text format and then it works. However, once I save and re-open the data it again converts to -0.235. I should save it in .csv format. Any advice?
Format -> Cells -> Custom - add new with.. (0);-0.
Then save as normal Excel.
If you save as CSV - then open it in Notepad or TextEdit you will see the parentheses and minus sign are saved.
But when re-opening it in Excel it reconverts it back to -1/1 etc losing your parentheses.
Best to use Excel format when saving to preserve the formatting options.
The problem is not when you save it in CSV (assuming you converted to text format as you mention above; or use a custom number format like that shown by #JGFMK). The problem is when you open it in Excel.
As is usually the case, in order to prevent Excel from doing automatic conversions, you need to IMPORT the csv file and not OPEN it. You will then have the opportunity to designate that column as TEXT, and your parentheses will be preserved.
When you are dealing with any CSV file, formatting is not included. So Excel tries to interpret the values as best it can (as if you were typing the value into a cell manually). This can cause issues not only with your circumstance, but also with certain fractions, ratios, dates not in the format of the computer system, etc. For all these reasons, you are often best off importing rather than opening any csv file in Excel.

funny format when copy from CSV

I used python to write some text to csv but it is stored in funny format.
output data is saved here:example data
for example, it is read as the below in csv excel
text shown in CSV
when i copy it to other platforms(notepad, word, web application) it turns into something else
after copy
I tried a numerous method include formatting with the CSV but it just wont work.
Could someone please help me.
With thanks,
Iverson
It's hard to guess what you mean...
Your file has TABs between many characters. But every line starts and ends in a double quote ("). So the whole line is one value (cell).

Excel xlsx file saving as CSV file - Korean and Japanese cracking badly

I am trying to make a CSV file from an Excel file. It has English, Korean and Japanese inputs. Right now it's saved as file.xlsx.
But when I try to save-as CSV through Excel as file.csv, all the Korean and Japanese inputs turn into question marks (???????)
I tried importing into Google Spreadsheets and exporting out as csv from there (from reading some other solutions) but it still turns into question marks.
I tried building a CSV file from scratch and just copying/pasting values from the Excel file into the CSV, but after I save it as CSV, the characters always crack.
Does anybody know how to work-around this? Thank you
I don't know that there IS an answer for this. CSV has no encoding, so it gets lost when you save in that format.
I tried, as a test, saving Chinese characters as a Unicode Text file, and believe it or not, that worked. So you may be able to do that, and simply change the filename to CSV. Assuming for some reason you NEED the filename to be CSV.
EDIT: I just ran addional testing on this. I was able to reimport the TXT file with either TXT or CSV extension, and the characters stayed just fine. So I think Unicode text is your answer.
Simply opening a CSV file in Excel only works when default assumptions hold. You may be writing the CSV correctly but not validating it properly.
It is more reliable to open a blank worksheet and then use Data Import. The encoding of the CSV file is one of the parameters you can specify.
To fully retain the characters while saving it on a CSV format and to somehow be able to import/re-use the data in the future.
You can follow these steps.
In Microsoft Excel, open the *.xlsx file.
Select Menu | Save As.
Enter any name for your file.
Under "Save as type," select Unicode Text.
Click Save.
Open your saved file in Microsoft Notepad.
Replace all tab characters with commas (",").
Select a tab character (select and copy the space between two column headers)
Open the "Find and Replace" window (Press Ctrl+H) and replace all tab characters with comma .
Click Save As.
Name the file, and change the Encoding: to UTF-8.
Change the file extension from .txt to .csv.
Click Save.
Open the .csv file in Excel to view your data.
Had the same issue. the below article shows the workaround in details:
https://help.salesforce.com/articleView?id=000003837&type=1
However, i decided to go with LibreOffice Calc, as it requires less steps to achieve the desired outcome. While exporting, you get to select charecter set, field delimiter and text decimeter.
For all other tasks, i prefer Excel.
Download and install Unicode CSV Addin for excel.
Save the csv from the new "Unicode CSV" menu as shown in picture
below.

How do I get my fortran output into excel?

After running a model in fortran (95) I end up with some result arrays (and one result matrix). I'd like to move these into excel for reporting purposes. What's the easiest way to do this?
As S. Lott said before me, CSV format is probably the best choice, but actually Excel is pretty clever about file formats. It will usually work with tab separated or space separated data, or even HTML tables. Try copy-and-pasting your data into Excel to see whether it can work it out, before worrying too much about the format.
Fix your Fortran output to be in CSV format. This is easily imported into a spreadsheet.
You can also write your data into a text file with the below code and then copy paste its contents to excel
before working with these data you must run "paste special wizard" to separate columns of the data in the excel
dimension a(100)
open (25,'output.txt')
do i=1,100
write(25,*) a(i)
end do

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