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 8697269
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T01:28:59+00:00 2026-06-13T01:28:59+00:00

I am reading an excel document as below: package com.sample.file; //necessary imports goes here

  • 0

I am reading an excel document as below:

package com.sample.file;

//necessary imports goes here

public class ExcelReader { 
   public static void main(String[] args) throws Exception{ 

  String fname = "C:\\myExcel.xls"; // or  "C:\\myExcel.xlsx"  
  InputStream inp = new FileInputStream(fname); 
  Workbook wb = WorkbookFactory.create(inp); 
  Sheet sheet = null; 

  sheet = wb.getSheetAt(0); 

  Iterator rows = sheet.rowIterator(); 

  while (rows.hasNext()) 
    { 
            Row row = (Row) rows.next(); 

            // how to write to a semicolon delimited dat file here
    }

  inp.close(); 
} 
}

As seen above, I am able to read the row. However, now I want to write that row into a semicolon delimited dat file.

Also, if a column is empty, it should go as an empty value in the file i.e. no data between consecutive semicolons.

  • 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-13T01:29:01+00:00Added an answer on June 13, 2026 at 1:29 am
    final StringBuilder sb = new StringBuilder("");
    while (rows.hasNext()) {
        Row row = (Row) rows.next(); 
        // how to write to a semicolon delimited dat file here
        Iterator<Cell> cells = row.cellIterator();
    
         while (cells.hasNext()) {
            Cell cell = cells.next();
            sb.append(cell.toString()).append(";");
        }
        sb.append("\n");
    }   
    
    File file = new File("someFile.dat");
    
    if (!file.exists()) {
        file.createNewFile();
    }
    
    FileWriter fw = new FileWriter(file.getAbsoluteFile());
    BufferedWriter bw = new BufferedWriter(fw);
    bw.write(sb.toString());
    bw.close();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just started C# today, and i have trouble reading an excel file. Here's
i am reading an excel file using this code i found over the net:
I am using Microsoft.Office.Interop.Excel in a winform where I am reading one excel file,
My code is as follows. Basically, I am reading an excel file and storing
I'm reading a .csv file that was created in Excel with the first line
I am parsing an Excel file and am having difficulty reading in the value
I'm reading an excel file with C# and OleDB (12.0). There I have to
currently I am having sucsess with reading the excel file with my c# ,net
Im reading an Excel document from C# Windows Form.. There are 25 worksheets in
Problem reading Excel 2007 file .xlsx file extention, while I am trying to read

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.