A
A
Alexey Smirnov2015-12-29 16:44:19
.NET
Alexey Smirnov, 2015-12-29 16:44:19

How can I transfer data from a 2-dimensional array to an Excel spreadsheet in C#?

Hello.
For example, there is such a 2-dimensional array:

string [,] array = {
                             { "кошка", "стрекоза", "собака", "слон" },
                             { "бабочка", "гусеница", "бегемот", "обезьяна" },
                             { "жираф", "синица", "воробей", "волк" }
                             { "жук", "муравей", "снеговик", "медведь" }
                             { "ящерица", "енот", "заяц", "лиса" }
                           };

How can I transfer data from this 2-dimensional array to an Excel table (that is, to an .xlsx file) so that this tabular data can then be processed in Excel?
PS At the same time, the table file (.xlsx) has not yet been created.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry Kovalsky, 2015-12-29
@ERAFY

The question needs clarification... do you want to serialize some data into an xls file? There is a crutch way, but it works - generate an html table with this data and save it to a file with the xls extension. If you want something more tricky - https://msdn.microsoft.com/en-us/library/ms173186(... Well, here's a suitable article

D
Denis Antonenko, 2015-12-30
@dabrahabra

The simplest and most reliable solution is to export data to CSV , Excel can open files in this format (you can import data from them into an existing workbook)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question