Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Java
  4. to open an excel file and write

to open an excel file and write

Scheduled Pinned Locked Moved Java
15 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Lost User

    Looking at the documentation (this link works for me[^]) it would suggest that you need to create a WritableWorkbook[^] and within that create a WritableSheet[^]. Casting a Sheet to a WritableSheet will not change the underlying object; it is still a (read-only) Sheet.

    speaking as ...

    P Offline
    P Offline
    prithaa
    wrote on last edited by
    #5

    thanks Richard but a

    WritableWorkbook creates a new workbook and has no method which opens a workbook

    Pritha

    L 1 Reply Last reply
    0
    • P prithaa

      thanks Richard but a

      WritableWorkbook creates a new workbook and has no method which opens a workbook

      Pritha

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #6

      This method[^] creates one. May I suggest you go through all the documentation to check which methods are required to create the objects you are trying to work with.

      speaking as ...

      P 1 Reply Last reply
      0
      • L Lost User

        This method[^] creates one. May I suggest you go through all the documentation to check which methods are required to create the objects you are trying to work with.

        speaking as ...

        P Offline
        P Offline
        prithaa
        wrote on last edited by
        #7

        thanks for the article but i cant still open a writableworkbook .i can write on a new

        workbook

        but cant write on an existing workbook I didnt find any method doing that either in writableworkbook regards Pritha

        A L 2 Replies Last reply
        0
        • P prithaa

          thanks for the article but i cant still open a writableworkbook .i can write on a new

          workbook

          but cant write on an existing workbook I didnt find any method doing that either in writableworkbook regards Pritha

          A Offline
          A Offline
          Anil Kumar 23
          wrote on last edited by
          #8

          Check this article ... may be of some help for your purpose Read and write to excel files in java

          1 Reply Last reply
          0
          • P prithaa

            thanks for the article but i cant still open a writableworkbook .i can write on a new

            workbook

            but cant write on an existing workbook I didnt find any method doing that either in writableworkbook regards Pritha

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #9

            prithaa wrote:

            thanks for the article

            I did not provide one, I wonder what you have been looking at.

            prithaa wrote:

            but i cant still open a writableworkbook

            Did you follow my advice and read all the documentation in the link I gave you? It clearly shows how to create a writeable workbook from an existing file.

            speaking as ...

            P 1 Reply Last reply
            0
            • L Lost User

              prithaa wrote:

              thanks for the article

              I did not provide one, I wonder what you have been looking at.

              prithaa wrote:

              but i cant still open a writableworkbook

              Did you follow my advice and read all the documentation in the link I gave you? It clearly shows how to create a writeable workbook from an existing file.

              speaking as ...

              P Offline
              P Offline
              prithaa
              wrote on last edited by
              #10

              yes i did read the link u sent and looked at the class writablework but there is no method which opens an existing .xls file Regards Pritha

              L 1 Reply Last reply
              0
              • P prithaa

                yes i did read the link u sent and looked at the class writablework but there is no method which opens an existing .xls file Regards Pritha

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #11

                Sorry, previous link was not correct owing to HTML frame. However, I think [this one](http://jexcelapi.sourceforge.net/resources/javadocs/current/docs/jxl/Workbook.html#createWorkbook\(java.io.File, jxl.Workbook, jxl.WorkbookSettings))[[^](http://jexcelapi.sourceforge.net/resources/javadocs/current/docs/jxl/Workbook.html#createWorkbook\(java.io.File, jxl.Workbook, jxl.WorkbookSettings))] is the best you will get.

                speaking as ...

                P 1 Reply Last reply
                0
                • L Lost User

                  Sorry, previous link was not correct owing to HTML frame. However, I think [this one](http://jexcelapi.sourceforge.net/resources/javadocs/current/docs/jxl/Workbook.html#createWorkbook\(java.io.File, jxl.Workbook, jxl.WorkbookSettings))[[^](http://jexcelapi.sourceforge.net/resources/javadocs/current/docs/jxl/Workbook.html#createWorkbook\(java.io.File, jxl.Workbook, jxl.WorkbookSettings))] is the best you will get.

                  speaking as ...

                  P Offline
                  P Offline
                  prithaa
                  wrote on last edited by
                  #12

                  thanks for replying

                  Workbook workbook = Workbook.getWorkbook(new File("d:/Writefile.xls"));
                  WritableWorkbook copy = Workbook.createWorkbook(new File("d:/Writefile1.xls"), workbook);
                  copy.write();
                  WritableSheet sheet = copy.getSheet("Report2");
                  Number number;
                  number = new Number(0, 0, 453.25, times);
                  sheet.addCell(number);
                  copy.write();
                  copy.close();

                  I want to open an existing file and add a cell to an existing sheet. The above code opens the file but the cell editing doesnt happen. Regards pritha

                  L 1 Reply Last reply
                  0
                  • P prithaa

                    thanks for replying

                    Workbook workbook = Workbook.getWorkbook(new File("d:/Writefile.xls"));
                    WritableWorkbook copy = Workbook.createWorkbook(new File("d:/Writefile1.xls"), workbook);
                    copy.write();
                    WritableSheet sheet = copy.getSheet("Report2");
                    Number number;
                    number = new Number(0, 0, 453.25, times);
                    sheet.addCell(number);
                    copy.write();
                    copy.close();

                    I want to open an existing file and add a cell to an existing sheet. The above code opens the file but the cell editing doesnt happen. Regards pritha

                    L Offline
                    L Offline
                    Lost User
                    wrote on last edited by
                    #13

                    Sorry, no idea why that's happening; I think you may need to re-check the documentation and work with your debugger.

                    speaking as ...

                    P 1 Reply Last reply
                    0
                    • L Lost User

                      Sorry, no idea why that's happening; I think you may need to re-check the documentation and work with your debugger.

                      speaking as ...

                      P Offline
                      P Offline
                      prithaa
                      wrote on last edited by
                      #14

                      Thankyou Richard for your help

                      L 1 Reply Last reply
                      0
                      • P prithaa

                        Thankyou Richard for your help

                        L Offline
                        L Offline
                        Lost User
                        wrote on last edited by
                        #15

                        Just for the record, I have never used these packages[^]; all the information I gave you I found by using Google and reading the Javadocs.

                        speaking as ...

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • World
                        • Users
                        • Groups