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).
Related
Since today, excel interprets the data of my xlsx file to add additional quote in the csv file.
It's anonying since I want only one quote for some columns and none for others.
I didnt have this problem before.
For instance :
text1;"text2" becomes text1;"""text2"""
I know that I can replace the triple quote in the output file with one quote, but cant I desactivate an option or whatever to avoid this ?
In the same way, when I save in csv file data which has been interpretaed by excel (like cells in number format instead of standard), the csv file keeps the excel format instead of saving sourcing data.
For example, 0 is "-" in number format and is saving as " - " in csv file instead of "0".
Thanks for helping :)
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.
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.
I have a text file with a list of usernames, and I have an excel file with about 4000 rows and about 9 columns. Basically what I'm looking to do is find any instance of anything from the TXT file in the Excel file. The match might not be EXACTLY the same, like :
TXT file has a row monkey1
excel file has a cell in column "C" with \\server1\monkey1
I would like to somehow flag that cell, or even the line in the TEXT file, or a seperate output.
I'm also pretty flexible on how to do this, like VBA/Macros etc. Or even putting this into an Access database or something similar. Or even converting the TXT to CSV or the Excel to another format.
Any advice would be greatly appreciated, or any guidance on what I should be looking for.
Thanks!
Export as csv
Write a python script that reads the csv with the csv module;
and the text file;
and then appends a magic string, like !! to each cell containing the text of a line from the text file;
then outputs a csv file with the updated table;
Then you can import it in excel;
And format-search-and-replace !! into a formatting of background color.
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. :-)