Creating a Workbook from input string

Hi,


Is it possible to create a workbook from a string (having a comma separated value format) as input?




Hi Bee,


Thank you for contacting Aspose support.

What I understand from your post is that you have the data in a String literal, and wish to create an instance of Workbook from it. If my understanding is correct, you can achieve the goal as demonstrated below.

Java

String input = “1, 2, 3, 4\n”
+ “5, 6, 7, 8”;
//Assumes that you want an InputStream that is a stream of bytes that represent your original string encoded as UTF-8
InputStream stream = new ByteArrayInputStream(input.getBytes(StandardCharsets.UTF_8));
Workbook book = new Workbook(stream, new TxtLoadOptions());
book.save(dir + “output.xlsx”);