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

  • Home
  • SEARCH
  • 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 5997475
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T00:16:09+00:00 2026-05-23T00:16:09+00:00

I am using Apache POI-HSSF for working with Excel files. I have a cell

  • 0

I am using Apache POI-HSSF for working with Excel files.

I have a cell in my spreadsheet that looks like “115”. I verified that it is formatted as “Text” (Format Cells -> Text).

However, when I read it in as
row.getCell(0).toString()

I get this string: “115.0”

This is incorrect. I should be getting “115” since it’s explicitly formatted as Text. How can I get the desired result? The cell can be anything, numbers or characters, and I expect the same string as in the cell. Thanks

  • 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-05-23T00:16:10+00:00Added an answer on May 23, 2026 at 12:16 am

    Formatted as text does not mean stored as text, they’re different. Excel has stored your cell as a number, and when you ask POI for the cell you get a numeric cell back.

    If you ask the cell you get back what type it is, you’ll discover it’s of type CELL_TYPE_NUMERIC and not CELL_TYPE_STRING

    What you’ll likely want to do is use the DataFormatter class to have your cell formatted as per Excel. It’ll then look like you expect. (As will cells formatted as currency, percentages etc too)

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

Sidebar

Related Questions

I'm using Apache POI to create a large Excel spreadsheet that is extremely formula
In Java, we're using the following package to programmatically create excel documents: org.apache.poi.hssf If
I'm trying to set Excel cell colors using Apache POI in Java. I played
I have just Extracted the cells from the excel sheet using Apache POI, everything
I'm generating an excel file using Apache POI 3.8 , and have the need
I have opened a large excel file as a Apache POI workbook (using VM
Using Apache POI HSSF, we can create xls file like this private void write(HSSFWorkbook
I am using Apache POI API to generate excel spreadsheet to output some data.
I have been using Apache POI to manipulate Microsoft Word .docx files — ie
I've been using Apache POI for some time to read existing Excel 2003 files

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.