Split Excel sheet into multiple sheets and rename sheets

InOutExcel.xlsx (12.4 KB)


May i get help to split excel sheet in multiple sheet based on row value , sample is attached . 1st sheet is input and rest is output required.

e.g. if col contains some value from their to the next appearance it should be moved to next sheet and sheet name should be that value… skipping value line …
pls check attached file



Can you try the following sample?

listIdx = dt1.AsEnumerable.Where(Function(r) r(0).ToString.Length=1).Select(Function(r) dt1.ROws.IndexOf(r)).ToList
dtMain = dt1.AsEnumerable.Where(Function(r,i) listIdx.Contains(i)).CopyToDataTable

arrDt = Enumerable.Range(0,listIdx.Count-1).Select(Function(idx,i)  dt1.AsEnumerable.Skip(listIdx(i)+1).Take(listIdx(i+1)-listIdx(i)-1).CopyToDataTable).ToArray

Sample20231012-4L.zip (12.4 KB)


1 Like

@Yoichi ,

Thanks, a lot!!!
This solution working exactly as required.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.