Skip to contents

Given a typing tool model, generate a typing tool spreadsheet with an overview tab, tab for individual allocation and tab for database allocation.

Usage

tt_model_render_tt_xlsx(
  model,
  file = NULL,
  engine = c("google", "excel"),
  database_prefill_n = NULL,
  database_formula_rows = 1000
)

Arguments

model

A typing tool model created with shelf_make_tt_model.

file

xlsx file name to save the typing tool to. If NULL, the function will return a Workbook object without creating a file.

engine

Spreadsheet formula and validation engine to target. "google" keeps the existing Google Sheets-oriented rendering. "excel" uses Excel-safe dropdown validation sources and Excel-oriented allocation formulas.

database_prefill_n

Number of respondent input rows to prefill in the "2. Database Allocation" tab. If NULL, the tab keeps the existing smoke test inputs: up to two examples per predicted segment. If larger than the smoke test set, extra rows are sampled from the model input data with replacement.

database_formula_rows

Number of respondent rows to prepare with formulas, validation and styling in the "2. Database Allocation" tab when engine = "excel". For engine = "google", the database allocation tab keeps using array formulas that expand over the entered respondent rows.

Spreadsheet engines

The default engine = "google" keeps the original Google Sheets-oriented rendering, including array formulas in the database allocation tab. Use engine = "excel" when you need a standalone Microsoft Excel workbook; this path uses named ranges for dropdowns and Excel-oriented formulas in the allocation tabs.

Examples

out_dir <- file.path(tempdir(), "g6tr.segmentation")
if (!dir.exists(out_dir)) dir.create(out_dir, recursive = TRUE)

tt_model_render_tt_xlsx(
  example_tt_model, 
  file.path(out_dir, "example_tt.xlsx")
)