0

I am creating a CSV file where i would like to insert the data in cell like 4/4 (Example)

then in Excel file it was showing as 4-Apr instead of 4/4

So I am asking you for the solution.

I tried with Escape sequences not helped me.

My code: builder.append(4 + "/" + 4 + ",");

In generated file it was showing as 4-Apr

Expected : 4/4 in Excel sheet Now i am getting output as : 4-Apr

6
  • 2
    Where is your code? Can you show what you have tried so far? Commented Sep 16, 2019 at 8:17
  • How looks your "Example"? Commented Sep 16, 2019 at 8:19
  • @deHaar builder.append(4 + "/" + 4 + ","); my code to build one cell in a row in excel using java. Due to private issues i can post only the line of code where i am facing issue sorry for that Commented Sep 16, 2019 at 9:43
  • @reporter I wan to show data something like 4/4 in my excel that will be builded by java but after creating an excel it was showing it as 4-Apr (Date format) Commented Sep 16, 2019 at 9:45
  • Do you need to display your data as X/Y or would some substitute like X of Y be sufficient, too? Do you want to display a formula (division) or something like two of four, like unsuccessful logins or anything... 4 of 4 would definitely not be interpreted as a date by Excel. Commented Sep 16, 2019 at 9:58

2 Answers 2

2

Try opening the CSV with a texteditor.

Excel sometimes assumes, how to display a given cell. And in this case it guesses "date".

Try prepending a " before 4/4, it might work, but this will contaminate your data.

HTH!

Sign up to request clarification or add additional context in comments.

1 Comment

I did the same but i shouldn't use the because my expected output should be like 4/4 only no other characters should be in that
1

Thanks for all your answers,

I found an answer for my Question After many trails at one trail we got the answer.

builder.append(4+"\t/"+4+","); resolved my issue.

But not sure how it got resolved by trying this? Can anyone help me

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.