You can do it as follows:
1) Convert your excelsheet to datatable first
2) And then convert your datatable to json as below:
1) convert excel sheet to datatable
string ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=G:\school pro\schools3.xlsx; Extended Properties=Excel 5.0"; StringBuilder stbQuery = new StringBuilder(); stbQuery.Append("SELECT top 10 * FROM [A1:M98]"); OleDbDataAdapter adp = new OleDbDataAdapter(stbQuery.ToString(), ConnectionString); DataTable dtSchools = new DataTable(); adp.Fill(dtSchools);
2) convert datatable to json
Newtonsoft.Json.JsonConvert.SerializeObject(dtSchools)
source share