Create a Worksheet and Seed It with Data
A 5-step recipe with Microsoft Excel. We can help you get access.
Recipe · 5 steps
Create a Worksheet and Seed It with Data
with Microsoft Excel
Create a worksheet and populate it with an initial block of values.
- Open a persisting workbook session so the new sheet and its seeded data are saved to the stored workbook.
- List the current worksheets so the caller can confirm the requested name is free. Excel returns ItemAlreadyExists if the name is already taken.
- Create the new worksheet. Excel appends it at the end of the workbook and returns its generated id and position.
- Write the initial block of values into the new sheet, addressing the range by the sheet name returned when it was created.
- Read the seeded range back to confirm the cell count and values match what was sent before any downstream chart or table work depends on it.
What you'll need to have ready
- itemId: The drive item id of the workbook file.
- worksheetName: The name to give the new worksheet (e.g. "Q3 Report").
- address: The A1-notation range to seed on the new sheet, sized to the values being written (e.g. "A1:C4").
- values: A two-dimensional array of values, typically a header row followed by data rows.
For your developer
Arazzo workflow microsoft-excel:create-worksheet-seed-data, 5 operations: createWorkbookSession → listWorksheets → createWorksheet → updateRange → getRange. Specs on APIs.io.