Exporting to CSV results in #name? - excel

I have an excel file where there are lots of fileds with value's in it. I have some values which are as shown below:
++++comme ca
Now when I convert this file to .csv, using excel 2010 it converts to =++++comme ca, by adding an equal sign and treating is as a formula and display #name?.
Do you have any idea how can I export to csv with the actual displayed values. I tried lots of things by saving it as xls and then doing it instead of xlsx. I even tried by converting the column to text formatting but that still didn't work
Any clues on this.

Text formatting doesn't change the fundamental values in a field, that's just for display purposes. If you want to force something to be treated as plain text, you need to prepend the value with a ', e.g. '++++ comme ca. The ' will tell Excel to NOT try to interpret the value as a formula or other special value - it'll just spit out the "string".

Related

SSRS Exporting to CSV format

When I export my information to CSV file so its in raw data format and easily used in one of the fields I have a number that is big (for example, 140313055811). It's really just an invoice number, but when I export it to CSV and open it, it shows something like 1.41E+11. I need to get it to display the full number instead of this. Is there a way? I tried making the textbox that its in as a number, I tried make the value area of the field =int(name of field), I tried changing it to text. None of these do the trick.
The only one that has worked is =FormatNumber(fieldname) and while this did work, it put commas in between as if it were a large number (this is an invoice number). So I was thinking I could use the =Format function but when it asks for "style as string" in the expression what do I put?
I need this report to be automated on the enterprise sharepoint site that's why I am going through great lengths to try to get it to automatically come out right.
Exporting it to excel form makes it hard to use the data, the CSV form is the best way to manipulate the data.
Thanks for any help, I appreciate it
You can do that using the IIF condition and checking which format you are exporting to - Something like:
=IIF(Globals!RenderFormat.Name = "EXCEL" or Globals!RenderFormat.Name = "CSV", "=""" + Fields!FieldName.Value + """", Fields!FieldName.Value)
You can then add an = and double quotes around the field value as shown. This will force Excel to render it as text without having to put a label around it.
If you check the CSV file in notepad, you might find the value as a scientific number before even making it to the excel.
You can stick spaces in front and/or behind the value to make the CSV file correct (and treat it as text), but excel will simply make it scientific again anyway the moment its opened and sees numbers.
The only solution I know of where the export ultimately is used in excel, is to stick a real character into the string like "INV: " before the value and deal with it in the excel file.
= "INV: " & Fields!invoicenumber.Value
so it reads "INV: 1230412893481239435" as text.

How to save excel columns with long numbers into csv?

Funny thing when I want to save Excel columns with long numbers like below, resulting csv contains converted numbers to scientific notation which is unusable. I want them to be save as text. Any trick to do that?
28160010390002003505456159
12160010390002003505456156
39160010390002003505456155
39160010390002003505456155
Append a TAB char (ASCII 9) at the end of a number.
In order to have those long (>15 digit) numbers in Excel, they are already formatted as text. I suspect that the .csv file also shows them as long numbers (if you open the csv file with Notepad), but that when you open the csv file in Excel, you see them as truncated and converted to scientific notation.
If that is the case, what you need to do is IMPORT the csv file. When you do that, the text-to-columns wizard will open, and allow you to format that column as text. The location of the Import is different in different versions. In Excel 2007, it is on the Data ribbon, Get External Data / From Text.
put the number as a function like below:
="123456789123456789"
If, as the original question seems to imply, you are actually:
already working with data in Excel, and
want to save to a CSV format without losing digits in an extra long number,
Then, before doing a 'Save As' to your CSV format, try formatting the column with a custom format, and in the box for the pattern just type #. This will force Excel to see it as a number, however many digits long, without trying to do something else with it like 4.52364E+14 when you actually save it to CSV.
At least, that is how it works for me in Excel 365 at this point in time.
If you are trying to get data into Excel from a CSV, then the answer about using the data import wizard is probably the safest bet instead.
This is an old question, but since at the moment it's still the top result on a google search for the topic, I think the thread should be kept current. Hussein mahyoub provided the only real answer to the question, yet has not gotten the up-votes.
The answer which tells us to add a tab character after your number gets you an string of text with a tab after it inside excel. It looks visually correct, but, it's not correct inside the spreadsheet. If the intent is to use the data in excel as excel data and use formula etc, it could cause problems. Interestingly if you put the tab before the text, it shows up in the data after the text.
The answer which tells us inserting a ' before the text gets a ' in the excel file. It's visually an incorrect representation of the data.
The answer which boasts the virtue of openoffice is simply an evil troll which does not even attempt to answer the question.
The answer that explains how to import a CSV that has not been properly formatted is good information, but, off topic.
The direct answer to the question is
converted to text,largest number
="123456789012",12345678901
Convert the numeric to text using text function.
Text(number,"0")
using openoffice you can save in csv format without problems.
Don't use Export to csv feature in Excel.
You can easy format that column to number in Excel, then use "Save as" it with csv and "yes" to confirm that you want to keep the format in csv.
That is work for me
Click on the column that has scientific exponent number and go to Format cells and then Numbers (decimal point as 0), save it as MSDOS CSV. Worked for me.

pentaho report excel output - leading '0' gets truncated

I have a format issue with my pentaho report excel/csv output.
My report output contains zip code column, which has leading zeroes if the zip code length is less than 5. the leading zeroes get truncated when i open the report output in excel file. I used 'textfield' for the zipcode column, i even tried concatenating zeroes in my xaction sql. everything works fine if i open the output in a text editor, but when we open it in excel file the zero got trimmed.
can we prevent this trimming issue or can we use other data fields in design instead of text field.
Change the extension of your csv to .txt so you get Excel's dialogue boxes for importing text files; there you can select the comma as your column delimiter. On the third screen (after you hit "next" twice), there is an option to choose the formatting of each column. Select you zip code column, change it from "General" to "Text" format, and your leading zeroes will be retained.
use text formatting in the Home-->Number-->Special
Cannt paste imapge--> i guess not enough points
Hope it helps
I don't know whether it is proper or not but enclose field in Double quotes or single which ever you prefer..
quotes will not display in excel file format but it will display in textpad or notepad..
So it you don't have any problem in adding this extra thing then it will solve your problem.
What is the original data format in your DB? Is it an INT?
In your sql statement, try something like this (adjust for the relevant sql dialect, if necessary):
lpad(cast(zip as CHAR(5)),5,'0') zip
where zip is your field name.
Then use text-field as you are already doing.

SSRS 2008 Excel Currency Cell Format

I'm using SSRS 2008 and I have a financial report. I would like the dollar amounts in my table to be in currency or number format when exported to Excel. Currently they end up being text.
I have trying a few things to see if its even possible. I removed the table header, didn't use the $ sign, and converted the field to decimal, but nothing seemed to work. The data in Excel always seems to be format as text.
Any suggestions?
Make sure you are using the Format string "C" but the export to excel is really a text rendering - it does not hold Excel specific attributes/qualities.
I found that instead of using a format function in the expression like:
=Format(myvar.value, "C")
Its better to not to use an expression and just change the Text Box Properties on that field. For example, I'd leave the field as:
=myvar.value
Then I would right click on the field, go to Text Box Properties, Number Sub Category/Tab, and select currency.
When doing this the results in Excel are a custom number format vs a text format.

Excel changes date formats

I run a process to produce a rather large CSV file of data. Sometimes I find it helpful to open the CSV in excel, make changes manually, and then re-save. However, if there are dates in the CSV, excel automatically reformats them. Is there a way to prevent excel from doing this? It would be helpful if I could turn off all text formatting altogether.
If you prepend an apostrophe ' to the beginning of any date string during the export process, Excel will read the value literally (i.e. as plain text) rather than trying to convert it to a date.
This particular solution is handled during the export process. I'm not sure how you would change Excel to treat the file differently at runtime.
Excel does some nasty tricks when outputting XML. One of its tricks is to drop left most column delimiters if 16 or so consecutive rows have no values for these columns. This means that if you're splitting the lines up based on commmas then these rows will have a different number of columns to the rest.
It will also drop any initial 0's so things like numeric Ids can become messed up.
Another risk you run is chopping the file off short since Excel can only support a maximum number of rows. (Prior to Excel 2007 this was around 65536)
If you need to do anything to a CSV file other than read it use a text editor.
When you import the CSV file into Excel, be sure to pre-format the date column as text. There's a frequently overlooked option in the parsing that allows you to control the format column by column. This also works well for preventing the leading zeros in New England ZIP codes from getting dropped in your contact lists.
If you used the excel file version which is 2010 or later (not sure lower version), you can set up to use current operation-system date format or not in Excel/CSV file.
Right Click cell with date value (e.g. '9/12/2013') in CSV file and pop up the menu
Click 'Format Cells' and open a pop up screen
Go to 'Number' tab and you can see 'Date' was selected in 'Category' (left side) and 'Type' on the right side
Observed that there are two types of Date format (one is with () and another is not with ()). Read the comment there and you can find that you can use the date format which is not with date. It means that your changes to the CSV file will not be applied with your current operation-system date format. So, I think date format won't be changed in CSV file in this case.

Resources