2
$\begingroup$

I would like to combine some pieces of data and export the data to Excel, but I need to insert some empty cells between pieces of data as the delimiter. For example, I have two lists listA={1,2,3}, listB={4,5,6}, and I want to add two empty cells between the two parts to look like this in the exported Excel file

enter image description here

One way I can think of is to include some empty items in the final list to export, e.g., listFinal={1, 2, 3, , , 4, 5, 6}, then Export[filepath + name, listFinal]. But I could not figure out how to produce listFinal from listA and listB with those empty items inserted. Or is there a better way to do this?

$\endgroup$

1 Answer 1

6
$\begingroup$

You can use Null for the empty elements e.g.

Export["foo.xlsx", listA~Join~{Null, Null}~Join~listB]

enter image description here

$\endgroup$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.