excel open existing .xls and write dotnet

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • csgraham74

    excel open existing .xls and write dotnet

    Hi guys,

    just wondering if anyone could - help me work out how to open an
    existing spreadsheet in excel and write to it then save it.

    I have some code that opens a new worksheet everytime but i want to
    just write info to the smae worksheet.

    Thanks
    in advance


    Colin

  • Elton W

    #2
    RE: excel open existing .xls and write dotnet

    You can use OleDbCommand to 'Insert' data to worksheet.

    HTH

    Elton Wang

    "csgraham74 " wrote:
    [color=blue]
    > Hi guys,
    >
    > just wondering if anyone could - help me work out how to open an
    > existing spreadsheet in excel and write to it then save it.
    >
    > I have some code that opens a new worksheet everytime but i want to
    > just write info to the smae worksheet.
    >
    > Thanks
    > in advance
    >
    >
    > Colin
    >
    >[/color]

    Comment

    • sloan

      #3
      Re: excel open existing .xls and write dotnet

      Check


      Thats "reading" data into a DataSet, but with the
      OleDbConnection
      you should be able to run an INSERT statement.

      Think of "Sheet1" as a table name. (the bottom tabs at the bottom of the
      excel file)




      "Elton W" <EltonW@discuss ions.microsoft. com> wrote in message
      news:B0BA85A8-90F4-4BB7-BA71-0BBBE7DC3A23@mi crosoft.com...[color=blue]
      > You can use OleDbCommand to 'Insert' data to worksheet.
      >
      > HTH
      >
      > Elton Wang
      >
      > "csgraham74 " wrote:
      >[color=green]
      > > Hi guys,
      > >
      > > just wondering if anyone could - help me work out how to open an
      > > existing spreadsheet in excel and write to it then save it.
      > >
      > > I have some code that opens a new worksheet everytime but i want to
      > > just write info to the smae worksheet.
      > >
      > > Thanks
      > > in advance
      > >
      > >
      > > Colin
      > >
      > >[/color][/color]


      Comment

      • rpraveen@syncfusion.com

        #4
        Re: excel open existing .xls and write dotnet

        Colin,

        If you want a way to do this in .Net without any dependancy on MS
        Excel, you could use Syncfuison's Essential XlsIO to insert data into
        existing Excel files:

        Build faster with enterprise-ready, AI-powered UI components including blazing fast grids, charts, schedulers, and editors. Get PDF, Word, and Excel document SDKs for Blazor, React, Angular, JavaScript, and .NET MAUI.


        Regards,
        Praveen Ramesh
        Syncfusion, Inc.
        Build faster with enterprise-ready, AI-powered UI components including blazing fast grids, charts, schedulers, and editors. Get PDF, Word, and Excel document SDKs for Blazor, React, Angular, JavaScript, and .NET MAUI.


        Comment

        Working...