I am having problems converting an MSaccess table that contains a 12 digits barcode-number field to CSV file
The barcode field is defined as text!
I tried exporting to Excel and saving the Excel file to CSV or exporting it to CSV But but that did not work either (even when the field is defined as text).
The problem is that some barcodes start with zero which gets truncated and that displays a scientific notation instead of displaying the barcode string.
My Question is: How can I generate a CSV file that is stored as an Excel spread sheet?
any help is appreciated
Dory
Nick McDermaid thanks for your comment. When looking in a text editor everything looks perfect.....You mean the people requesting it on my website are actually using it as text file and do not care about the way it looks in a spread sheet? if so then I am just chasing a wild goose! is that what you mean?
So I have a script in PHP that creates tab separated CSV output.
I have a button in my HTML that works like so:
Export Data
Ideally I want the user to open this CSV file in Excel.
The issue I have here is with tab separated CSVs, the file extension, and how Excel handles all of this. For example:
download="export.csv"
Results in the Browser asking me to open this in Excel (wanted behaviour), but then once in Excel none of the columns are respected as they are tab separated (not comma separated, which Excel is obviously expecting).
download="export.xls"
Results in the Browser asking me to open this in Excel (again, wanted behaviour), but then Excel complains that the file extension and the contents do not match and gives the user a warning. If the user goes past this warning the data displays as expected, but I could do without the warning.
download="export.txt"
Results in the Browser downloading the file as a text file. Once imported into Excel, the columns are respected, but I could do with this being thought of as an Excel file like CSV files are.
download="export.tsv"
Results in the Browser downloading the file, but as this extension isnt recognized, it will need to be imported into Excel manually, which isn't what I am after. Infact, even though TSV is the most correct file extension for tab separated verse, the TXT extension seems to work more smoothly.
I am unable to set file associations on the end users machine, and I would like to avoid going down the "export your data as an actual XLXS file" route if at all possible. I would prefer to use tab separated CSVs over comma separated CSVs because the exported data contains lots of commas naturally.
EDIT:
So as per Ron Rosenfeld suggested I tried outputting a comma separated CSV file with quotes around the data - and the file loads into Excel, with columns preserved - however the quotes appear on every piece of data in every column that uses quotes.
Is it possible to not have the quotes appear?
Ideally I would prefer to have the content tab separated, but at this stage anything that allows me to open a CSV file from a browser into Excel would be great.
I want a way to download a tab separated CSV file from a browser to Excel with as little fuss as possible. How can this be achieved?
The difference between the CSV and TSV files are - as long as the creator followed some rules, that: CSV file will have comma separated values and a TSV file will have tab separated values.
For TXT files, there is no formatting specified.
CSV files are comma-delimited, so you have to use this:
sep=,
And TSV files are tab-delimited, so you have to use this:
sep=\t
If you have MS Excel installed on your computer, CSV files are closely associated with Excel.
Please, look at this post to find out what the use of sep=; for UTF-8 and UTF-16LE leads to.
It's very important to properly output UTF-8 and UTF-16LE CSV files in PHP.
So THIS POST will be informative and useful for you.
CSV means "comma separated values", so the default separator is a ,.
To change that separator to a tab, put
sep=\t
as the first line in your .csv-file (yes, you can still name it .csv). That tells excel what the delimiter character should be.
Note, that if you open the .csv with an actual text editor, it should read like
sep= (an actual tabulator character here, it's just not visible...)
This feature is not officially defined in the .csv RFC 4180, so if it works with any software other than Excel depends on that software's implementation.
I have done this before. A painful experience, which I rather not relive. but since you asked (and bountied).
Make sure your http-headers read: Content-Type: application/x-www-form-urlencoded
Make ; your separator
Don't enclose by " (This is a magic I have yet to understand).
Fingers crossed
This question's asked before. The solution given on this post works only for some of the special characters. When i save the file with Utf-8, some characters are saved as question marks in the CSV file. For example, this character ∑ is saved as ? mark in the csv file.
Is there another encoding method that I should use?
The file that I want to save includes these special characters : ∏∑€₭₮₲₽£¥§ßØæŒƂƌƜȹȻɄɅɸͶΏΨπλЖяӨ
I've got an application that exports a .CSV file with many data, however every time where there is an accent, the files changes the letter to $#231;,
Already converted the file and the text to UTF-8 and it does not fix the problem
Tried the conversion with Excel and also Open Office without success.
Does anybody have any idea how to fix this issue ?
Follow an example of wrong data extracted (the text is in Brazilian language):
Lol, after i paste the wrong data in the StackOverflow text to post, the data convert to the correct data.
Anybody has any idea ?
Data Conversion Correctly
I have an excel file with arabic data in windows , now I want to import this file into my oracle database which installed in oracle linux 5.9.
I exported my excel file as csv format but linux couldn't display arabic data
I used sqlldr and import csv file into database but unfortunately arabic data marked as question mark.
I dont hve any problem in insert and display arabic characters when I use insert statement, my characterset is AR8MSWIN1256.
Now how can I import arabic data?
Thanks in advance.
There's a workaround that works for me
Save the excel file as "Unicode text (*.txt)
Open the text file, you'll find every column separated from neighboring columns by a "tab", copy that tab and "find+replace" it with a comma "," in the entire file.
If there's extra tabs at the end of the table it will result in a series of extra commas, delete those!
Save the file then manually change its extension from (.txt) to (.csv)
The file should now display the Arabic characters normally, and you can export it to any application as a CSV file