# Exporting \*formatted\* data to Microsoft Excel?

**URL:** <https://community.wolfram.com/t/exporting-formatted-data-to-microsoft-excel/9514>\
**Category:** Questions\
**Tags:** mathematica, external-interfaces, import-and-export\
**Created:** [October 26, 2016, 2:46pm UTC](https://community.wolfram.com/t/exporting-formatted-data-to-microsoft-excel/9514 "2016-10-26T14:46:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ms](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/ms/32/13335_2.png) [@ms](https://community.wolfram.com/u/ms)\
**Post date:** [October 26, 2016, 2:46pm UTC](https://community.wolfram.com/t/exporting-formatted-data-to-microsoft-excel/9514/1 "2016-10-26T14:46:22Z")

</div>

I export Mathematica tables to Excel every day, for sharing reports with non-Mathematica users. It exports the values without flaw, but ignores any formatting. Consider the following:

```
colHeadings = {"datum 1", "datum 2"};
rowHeadings = {"yesterday", "today", "tomorrow"};
data = {{1.2, 2.4}, {1.3, 2.1}, {1.31, 2.0}};
dataT = Prepend[Partition[Flatten[Transpose[{rowHeadings, data}]], 3],
   Flatten[{"", colHeadings}]];

```

I would like to export this to Excel with a modest amount of formatting – column borders would suffice. It’s easy to format the data in Mathematica, some examples follow:

```
table1 = TableForm[dataT]

table2 = TableForm[data, TableHeadings -> {rowHeadings, colHeadings}]

grid1 = Grid[dataT, Alignment -> {{Right, {Decimal}}}, 
  Dividers -> {All, {True, True, {False}, True}}]

```

But no matter which of these I export to Excel, it comes out the same, as a raw data table.

```
Export[FileNameJoin[{$HomeDirectory, "Desktop", "dataT.xlsx"}], dataT]

Export[FileNameJoin[{$HomeDirectory, "Desktop", 
   "table1.xlsx"}], table1]

Export[FileNameJoin[{$HomeDirectory, "Desktop", 
   "table2.xlsx"}], table2] (* omits the column and row headings *)

Export[FileNameJoin[{$HomeDirectory, "Desktop", "grid1.xlsx"}], grid1]

```

Any suggestions, or am I asking for something that Mathematica just can’t do?

---

<div class="post-metadata">

**Author:** ![gdelfino](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/gdelfino/32/41294_2.png) [@gdelfino](https://community.wolfram.com/u/gdelfino)\
**Post date:** [October 26, 2016, 7:15pm UTC](https://community.wolfram.com/t/exporting-formatted-data-to-microsoft-excel/9514/2 "2016-10-26T19:15:49Z")

</div>

Michael,

If you are using Windows, you can do that using .NET/Link

> **[.NET/Link User Guide—Wolfram Documentation](https://reference.wolfram.com/language/NETLink/tutorial/Overview.html)**
>
> Introduction Calling .NET from the Wolfram Language Calling the Wolfram Language from .NET

There is an example here:

[http://mathematica.stackexchange.com/questions/38891/formatting-excel-borders-with-net](http://mathematica.stackexchange.com/questions/38891/formatting-excel-borders-with-net)
