Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8840167
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T10:24:13+00:00 2026-06-14T10:24:13+00:00

I am using jExcel API to write data to excel sheet. And below is

  • 0

I am using jExcel API to write data to excel sheet. And below is my code which is working fine. But If I am writing large number of data to Excel sheet, I am getting this exception-

jxl.write.biff.RowsExceededException: The maximum number of rows permitted on
a worksheet been exceeded

Below is the code. How can I write data to another sheet if first sheet does not accommodate any more rows. Can anyone help me out here?

 public void write() throws IOException, WriteException {

    readFileIPAddress();

    File file = new File(inputFile);
    WorkbookSettings wbSettings = new WorkbookSettings();

    wbSettings.setLocale(new Locale("en", "EN"));

    WritableWorkbook workbook = Workbook.createWorkbook(file, wbSettings);
    workbook.createSheet("Report", 0);
    WritableSheet excelSheet = workbook.getSheet(0);
    createLabel(excelSheet);
    createContent(excelSheet);

    workbook.write();
    workbook.close();
    }


    private void createLabel(WritableSheet sheet) throws WriteException {

    WritableFont times15pt = new WritableFont(WritableFont.TAHOMA, 11);
    times = new WritableCellFormat(times15pt);
    times.setWrap(true);

    WritableFont times10ptBoldUnderline = new WritableFont(WritableFont.TAHOMA, 13, WritableFont.BOLD, false, UnderlineStyle.SINGLE);
    timesBoldUnderline = new WritableCellFormat(times10ptBoldUnderline);
    timesBoldUnderline.setWrap(true);

    CellView cv = new CellView();
    cv.setFormat(times);
    cv.setFormat(timesBoldUnderline);
    cv.setAutosize(true);

    addCaption(sheet, 0, 0, "IP Address");
    addCaption(sheet, 1, 0, "Digital Element Country Code");
    addCaption(sheet, 2, 0, "Maxmind Country Code");
    addCaption(sheet, 3, 0, "Neustar City");
    addCaption(sheet, 4, 0, "Maxmind City");
    addCaption(sheet, 5, 0, "Neustar Zip Code");
    addCaption(sheet, 6, 0, "Maxmind Zip Code");
    }

     private void createContent(WritableSheet sheet) throws WriteException, RowsExceededException {

    NaEdgeDb edge = null;
    try {
    while (!workQueue.isEmpty()) {
        String ipAddress = workQueue.take();

        edge = new NaEdgeDb();
        edge.set_server_addr(serverIPAddress);
        edge.set_id(10);
        if (checkIPDuplicate.add(ipAddress)) {

            resp = GeoLocationService.getLocationIp(ipAddress, 0);
            edge.naQueryEdge(ipAddress);

            addNumber(sheet, 0, j, ipAddress);

            addNumber(sheet, 1, j, (edge.edge_twoLetterCountry));

            addNumber(sheet, 2, j, (resp.getLocation() != null ? resp.getLocation().getCountry() : null));

            addNumber(sheet, 3, j, (edge.edge_city));

            addNumber(sheet, 4, j, (resp.getLocation() != null ? resp.getLocation().getCity() : null));

            addNumber(sheet, 5, j, (edge.edge_postalCode));

            addNumber(sheet, 6, j, (resp.getLocation() != null ? resp.getLocation().getZipCode() : null));
            j++;
        } 
        } 
    } catch (Exception e) {
        getLogger().log(LogLevel.ERROR, e.fillInStackTrace());
        e.printStackTrace();
    }
  }

    private void addCaption(WritableSheet sheet, int column, int row, String s) throws RowsExceededException,
        WriteException {
    Label label;
    label = new Label(column, row, s, timesBoldUnderline);
    sheet.addCell(label);
    }

    private void addNumber(WritableSheet sheet, int column, int row, String str) throws WriteException,
        RowsExceededException {
    Label number;
    number = new Label(column, row, str);
    sheet.addCell(number);
    }

Updated Code:-

This is still throwing same exception. Don’t know why? I already handled creation of new sheet in this code? Any problem with this code?

 private void createContent(WritableSheet sheet, WritableWorkbook workbook2) throws WriteException, RowsExceededException {

    NaEdgeDb edge = null;
    WritableSheet ws2 = workbook2.createSheet("sheet2", 2);
    try {
    while (!workQueue.isEmpty()) {
        String ipAddress = workQueue.take(); // generateIPAddress();

        edge = new NaEdgeDb();
        edge.set_server_addr(serverIPAddress);
        edge.set_id(10);
        System.out.println(sheet.getRows());
        if (checkIPDuplicate.add(ipAddress) && sheet.getRows() <= 65536 ) {

            resp = GeoLocationService.getLocationIp(ipAddress, 0);
            edge.naQueryEdge(ipAddress);

            addNumber(sheet, 0, j, ipAddress);

            addNumber(sheet, 1, j, (edge.edge_twoLetterCountry));

            addNumber(sheet, 2, j, (resp.getLocation() != null ? resp.getLocation().getCountry() : null));

            addNumber(sheet, 3, j, (edge.edge_city));

            addNumber(sheet, 4, j, (resp.getLocation() != null ? resp.getLocation().getCity() : null));

            addNumber(sheet, 5, j, (edge.edge_postalCode));

            addNumber(sheet, 6, j, (resp.getLocation() != null ? resp.getLocation().getZipCode() : null));
            j++;
        } else {
            resp = GeoLocationService.getLocationIp(ipAddress, 0);
            edge.naQueryEdge(ipAddress);

            addNumber(ws2, 0, j, ipAddress);

            addNumber(ws2, 1, j, (edge.edge_twoLetterCountry));

            addNumber(ws2, 2, j, (resp.getLocation() != null ? resp.getLocation().getCountry() : null));

            addNumber(ws2, 3, j, (edge.edge_city));

            addNumber(ws2, 4, j, (resp.getLocation() != null ? resp.getLocation().getCity() : null));

            addNumber(ws2, 5, j, (edge.edge_postalCode));

            addNumber(ws2, 6, j, (resp.getLocation() != null ? resp.getLocation().getZipCode() : null));
            k++;
        }
        } 
    } catch (Exception e) {
        getLogger().log(LogLevel.ERROR, e.fillInStackTrace());
        e.printStackTrace();
    }
    System.out.println("Size of HashSet:" + checkIPDuplicate.size());
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T10:24:15+00:00Added an answer on June 14, 2026 at 10:24 am

    I think you can use WritableWorkbook#createSheet(java.lang.String, int)) to create the new sheet when required.

    Instead of WritableSheet, pass WritableWorkbook in createContent method. Check the number of rows added in the current sheet using some counter. If sheet is full (counter == MAX_ROWS), create a new sheet and reset the row counter to 0.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I had used JExcel API for importing Data's from Excel,for using JExcel , I
I need to read large excel sheets using Java. The Excel sheet may be
I have a need to generate an excel sheet report which looks like the
I using jexcelapi for android . I write string Hello jExcelAPI!, but when I
our Java EE applications writes large (>3000 rows, >300 columns) Excel files using Apache
Using the C# Facebook SDK 5.0.3 everything works fine whit the client.Get(/me). But when
Scenario: I am trying to read an excel file using JExcel and dump the
using Telerik.WinControls.Data; using Telerik.WinControls.UI.Export; namespace Directory { public partial class radForm : Form {
Using jQuery I'm trying to obtain the rotation state of an object but in
Using Android TelephonyManager an application can obtain the state of data activity over the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.