C# Class ExcelToJsonConverter, ExcelToJsonConverter

ファイルを表示 Open project: Benzino/ExcelToJsonConverter Class Usage Examples

Public Methods

Method Description
ConvertExcelFileToJson ( string filePath, string outputPath ) : bool

Converts each sheet in the specified excel file to json and saves them in the output folder. The name of the processed json file will match the name of the excel sheet. Ignores sheets whose name begin with '~'. Also ignores columns whose names begin with '~'.

ConvertExcelFilesToJson ( string inputPath, string outputPath, bool recentlyModifiedOnly = false ) : void

Converts all excel files in the input folder to json and saves them in the output folder. Each sheet within an excel file is saved to a separate json file with the same name as the sheet name. Files, sheets and columns whose name begin with '~' are ignored.

Private Methods

Method Description
GetExcelDataReaderForFile ( string filePath ) : IExcelDataReader

Gets the excel data reader for the specified file.

GetExcelDataSet ( string filePath ) : DataSet

Gets the Excel data from the specified file

GetExcelFileNamesInDirectory ( string directory ) : List

Gets all the file names in the specified directory

GetExcelSheetData ( IExcelDataReader excelReader ) : DataTable

Gets the Excel data from current spreadsheet

GetSheetNamesInFile ( string filePath ) : List

Gets the list of sheet names in the specified excel file

GetSpreadSheetJson ( DataSet excelDataSet, string sheetName ) : string

Gets the json data for the specified spreadsheet in the specified DataSet

RemoveUnmodifiedFilesFromProcessList ( List excelFiles, string outputDirectory ) : List

Removes files which have not been modified since they were last processed from the process list

WriteTextToFile ( string text, string filePath ) : void

Writes the specified text to the specified file, overwriting it. Creates file if it does not exist.

Method Details

ConvertExcelFileToJson() public method

Converts each sheet in the specified excel file to json and saves them in the output folder. The name of the processed json file will match the name of the excel sheet. Ignores sheets whose name begin with '~'. Also ignores columns whose names begin with '~'.
public ConvertExcelFileToJson ( string filePath, string outputPath ) : bool
filePath string File path.
outputPath string Output path.
return bool

ConvertExcelFilesToJson() public method

Converts all excel files in the input folder to json and saves them in the output folder. Each sheet within an excel file is saved to a separate json file with the same name as the sheet name. Files, sheets and columns whose name begin with '~' are ignored.
public ConvertExcelFilesToJson ( string inputPath, string outputPath, bool recentlyModifiedOnly = false ) : void
inputPath string Input path.
outputPath string Output path.
recentlyModifiedOnly bool If set to true, will only process recently modified files only.
return void