Postingan

Menampilkan postingan dari Oktober, 2020

Change General to Text CSV

  I have found that putting an '=' before the double quotes will accomplish what you want. It forces the data to be text. eg. ="2008-10-03",="more text" Enable Ginger Cannot connect to Ginger Check your internet connection or reload the browser Disable in this text field Edit Edit in Ginger Edit in Ginger ×

Write CSV with java

  import java.io.File; import java.io.FileNotFoundException; import java.io.PrintWriter; public class CsvWriter { public static void main (String[] args) { try (PrintWriter writer = new PrintWriter( new File( "test.csv" ))) { StringBuilder sb = new StringBuilder(); sb.append( "id," ); sb.append( ',' ); sb.append( "Name" ); sb.append( '\n' ); sb.append( "1" ); sb.append( ',' ); sb.append( "Prashant Ghimire" ); sb.append( '\n' ); writer.write(sb.toString()); System.out.println( "done!" ); } catch (FileNotFoundException e) { System.out.println(e.getMessage()); } } } Enable Ginger Cannot connect to Ginger Check your internet connection or reload the browser Disable in this text field Edit Edit in Ginger Edit in Ginger ×