Table of Contents

ExcelWriter interacts with existing Workbook content in two possible ways when importing data.

Introduction

There are two ways to insert rows of data using ExcelWriter:

ExcelTemplate.BindData

When data is imported into a template file that contains data markers with ExcelTemplate.BindData (API Reference), the following is true:

For example, we start with a simple template file that contains data markers:

Here is the template after it has been populated with data:

Below is a break down of what was affected when the data was imported.

Content below the data markers

In this example, there is content below the data marker row (a Grand Total row and a blue footer row). These will be pushed down as new rows are inserted.

Before importing data


After the data is imported, these rows are moved from rows 4 & 5, to rows 7 & 8.

Formatting on the data marker row

There are several formatting elements on the data marker row. This formatting will be applied to each new row of data.

Before importing data

After the data is imported, this formatting is applied to rows 3 through 6.

Formulas

Before/After 'SUM' formula:

Before/After formula:

 

 

Worksheet.ImportData

When data is imported into a worksheet using ExcelApplication's Worksheet.ImportData (API Reference), the following is true:

For example, we take the same template, but remove the data markers:

Before

When the data is imported, the SUM formula that was in cell B4 is overwritten with one of the new values. Also, the formatting in cells A4, B3, B4, and C3 is only there because it was present in the original template. Also, the background color in row 5 was removed when the data was imported.

After