Add column to excel
-
HI, in my code, I am checking for a excel file exists or not. if it doesn't exists i am trying to creating new one along with some columns. here i am able to create the excel file but i don't know how to add columns to it. can any one please help?? below is my code block.
private void CheckExcelfile()
{
string path = @"C:\Servicedeatils.xls";
if (!File.Exists(path))
{
using (StreamWriter sw = File.CreateText(path))
{
How to add columns to the created excel file??} } }
fttyhtrhyfytrytrysetyetytesystryrty
-
HI, in my code, I am checking for a excel file exists or not. if it doesn't exists i am trying to creating new one along with some columns. here i am able to create the excel file but i don't know how to add columns to it. can any one please help?? below is my code block.
private void CheckExcelfile()
{
string path = @"C:\Servicedeatils.xls";
if (!File.Exists(path))
{
using (StreamWriter sw = File.CreateText(path))
{
How to add columns to the created excel file??} } }
fttyhtrhyfytrytrysetyetytesystryrty
This is very wrong. You are not creating a Excel file, but a text file with the extension .xls. To use Excel you mainly have 2 options: 1) Interrop 2) OleDB * 3) Commercial apps that ease process of writing/reading to/from Excel. Bingle for "Excel C#" and you'll find many resources. Here on CP there are some nice articles on using Excel.
Just an irritated, ranting son of ... an IT guy. At your trolling services
-
HI, in my code, I am checking for a excel file exists or not. if it doesn't exists i am trying to creating new one along with some columns. here i am able to create the excel file but i don't know how to add columns to it. can any one please help?? below is my code block.
private void CheckExcelfile()
{
string path = @"C:\Servicedeatils.xls";
if (!File.Exists(path))
{
using (StreamWriter sw = File.CreateText(path))
{
How to add columns to the created excel file??} } }
fttyhtrhyfytrytrysetyetytesystryrty
Hi, Thanks for reply. instead of using File.CreateText, i can use File.Create(path) also i think this will create the required file. but here i am struck with adding columns to it. how to do that?
fttyhtrhyfytrytrysetyetytesystryrty
-
Hi, Thanks for reply. instead of using File.CreateText, i can use File.Create(path) also i think this will create the required file. but here i am struck with adding columns to it. how to do that?
fttyhtrhyfytrytrysetyetytesystryrty