{"record":{"id":"99118cc0ae4b2dd3","repo":"iOfficeAI/OfficeCLI","slug":"unsupported-type","errorCode":"unsupported_type","errorMessage":"Import is only supported for .xlsx files in V1","messagePattern":"Import is only supported for \\.xlsx files in V1","errorType":"exception","errorClass":"CliException","httpStatus":null,"severity":"error","filePath":"src/officecli/CommandBuilder.Import.cs","lineNumber":55,"sourceCode":"        {\n            var file = result.GetValue(importFileArg)!;\n            var parentPath = OfficeCli.Core.MsysPathHint.Restore(result.GetValue(importParentPathArg)!)!;\n            var source = result.GetValue(importSourceOpt) ?? result.GetValue(importSourceArg);\n            var useStdin = result.GetValue(importStdinOpt);\n            var format = result.GetValue(importFormatOpt);\n            var header = result.GetValue(importHeaderOpt);\n            var startCell = result.GetValue(importStartCellOpt)!;\n\n            if (!file.Exists)\n                throw new CliException($\"File not found: {file.FullName}\")\n                {\n                    Code = \"file_not_found\",\n                    Suggestion = $\"Create the file first: officecli create \\\"{file.FullName}\\\"\"\n                };\n\n            var ext = Path.GetExtension(file.FullName).ToLowerInvariant();\n            if (ext != \".xlsx\")\n                throw new CliException(\"Import is only supported for .xlsx files in V1\")\n                {\n                    Code = \"unsupported_type\",\n                    Suggestion = \"Use a .xlsx file\"\n                };\n\n            // Read CSV content\n            string csvContent;\n            if (useStdin)\n            {\n                // StripBom for the same reason batch does it: File.ReadAllText\n                // (the --file branch below) drops a UTF-8 BOM implicitly, the\n                // stdin reader hands it through. Without this, `import --stdin`\n                // fed a BOM'd CSV put a stray U+FEFF inside the first header\n                // cell while `import --file` on the same bytes did not.\n                csvContent = StripBom(StdIn.ReadToEnd());\n            }\n            else if (source != null)\n            {","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/iOfficeAI/OfficeCLI/blob/1ced45e900782c5083ed550ddf328ee974e425e7/src/officecli/CommandBuilder.Import.cs#L37-L73","documentation":"The import command only supports .xlsx workbooks as the import target in V1. This fires when the target file exists but has an extension other than .xlsx (e.g. .docx, .pptx, .csv).","triggerScenarios":"'officecli import notes.docx --file data.csv' or any import whose target file extension is not .xlsx.","commonSituations":"Reusing an existing non-spreadsheet document as the import target; confusing the import source (CSV/TSV) with the target (must be xlsx).","solutions":["Switch the target to a .xlsx workbook.","If you need a new spreadsheet, 'officecli create out.xlsx' first."],"exampleFix":"// before\nofficecli import summary.docx --file data.csv\n// after\nofficecli import summary.xlsx --file data.csv","handlingStrategy":"validation","validationCode":"var ext = Path.GetExtension(targetXlsx).ToLowerInvariant();\nif (ext != \".xlsx\")\n    throw new ArgumentException($\"Import target must be .xlsx, got '{ext}'.\");","typeGuard":"static bool IsXlsxTarget(string f) =>\n    Path.GetExtension(f).Equals(\".xlsx\", StringComparison.OrdinalIgnoreCase);","tryCatchPattern":null,"preventionTips":["The import target is always xlsx in V1; CSV/TSV is the source, not the target.","Validate target extension before invoking import."],"tags":["import","unsupported-type","xlsx","v1"],"backgroundTag":null,"analyzedSha":"1ced45e900782c5083ed550ddf328ee974e425e7","analyzedAt":"2026-08-13T13:01:07.193Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}