Can i expand variablearray from variablearray

Hi,

I was wondering if we can do something like this.

// Creating an array containing names as string values
string[] names = new string[] { “&=variablearray1(horizontal)”, “&=variablearray2(horizontal)”, “&=variablearray3(horizontal)” };

// Importing the array of names to 1st row and first column vertically
worksheet.Cells.ImportArray(names, 0, 0, true);

Assume variablearray1…3 has string values.

If importarray don’t work can I do with some other option.

I want to achieve following from these variablearrays

kunal, vivek, ashwin, sudhir
apple, pineapple,lemon
sandpiper, pigeon

assume “comma” = new column in excel.

@kuns200,
Thank you for your query.
I have checked different options for importing arrays but could not find any options which can fulfill your requirements, however using CSV, you may achieve it. Here an example is given where a string is to be formatted in memory and then that memory stream is to be loaded into Workbook as CSV data. Please modify it as per your requirements to create such string and then use it as mentioned in the following sample code.

TxtLoadOptions opts = new TxtLoadOptions();
opts.Separator = ',';

string data = string.Format("kunal,vivek,ashwin,sudhir" + Environment.NewLine + "apple,pineapple,lemon" + Environment.NewLine + "sandpiper,pigeon");
byte[] byteArray = Encoding.ASCII.GetBytes(data);
MemoryStream stream = new MemoryStream(byteArray);
stream.Position = 0;
Workbook workbook = new Workbook(stream, opts);
workbook.Save("output_out.xlsx");