Initial commit
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
using OfficeOpenXml;
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
// Quick utility to inspect Excel file structure
|
||||
ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
|
||||
|
||||
var file = @"Y:\PCC\Quickbooks\Online\Customers.xls";
|
||||
Console.WriteLine($"Inspecting: {file}\n");
|
||||
|
||||
try
|
||||
{
|
||||
using var package = new ExcelPackage(new FileInfo(file));
|
||||
var worksheet = package.Workbook.Worksheets[0];
|
||||
|
||||
Console.WriteLine($"Worksheet: {worksheet.Name}");
|
||||
Console.WriteLine($"Rows: {worksheet.Dimension.Rows}");
|
||||
Console.WriteLine($"Columns: {worksheet.Dimension.Columns}\n");
|
||||
|
||||
Console.WriteLine("Column Headers (Row 1):");
|
||||
for (int col = 1; col <= worksheet.Dimension.Columns; col++)
|
||||
{
|
||||
var header = worksheet.Cells[1, col].Value?.ToString() ?? "";
|
||||
Console.WriteLine($" [{col}] {header}");
|
||||
}
|
||||
|
||||
Console.WriteLine("\nSample Data (Row 2):");
|
||||
if (worksheet.Dimension.Rows >= 2)
|
||||
{
|
||||
for (int col = 1; col <= worksheet.Dimension.Columns; col++)
|
||||
{
|
||||
var value = worksheet.Cells[2, col].Value?.ToString() ?? "";
|
||||
var truncated = value.Length > 50 ? value.Substring(0, 50) + "..." : value;
|
||||
Console.WriteLine($" [{col}] {truncated}");
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"Error: {ex.Message}");
|
||||
}
|
||||
Reference in New Issue
Block a user