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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:31:47+00:00 2026-05-23T17:31:47+00:00

I wanted to read excel file so i did following steps. First creating .csv

  • 0

I wanted to read excel file so i did following steps. First creating .csv file of the .xls file. But .csv file is opening in excel.

   NSBundle *bundle = [NSBundle mainBundle];
   NSString *xlsFilePath = [bundle pathForResource:@"sampleXLSFile" ofType:@"xls"];
   NSString *csvFilePathLoc =  [[xlsFilePath stringByDeletingLastPathComponent] stringByAppendingPathComponent:@"NewSample.csv"];
   NSData *data = [NSData dataWithContentsOfFile:xlsFilePath];
   NSLog(@"data value: %@", data);
   NSFileManager *csvFile = [NSFileManager defaultManager];

if([csvFile createFileAtPath:csvFilePathLoc contents:data attributes:nil])
{
    NSLog(@"File created");
}
else {
    NSLog(@"File not created");
}

NSString *contentsOfCSVFile = [NSString stringWithContentsOfFile:csvFilePathLoc];
NSLog(@"contentsOfCSVFile value: %@",contentsOfCSVFile);

NewSample.csv file is created at application folder location. But when its not comma seperated it still opens in excel format.And when i NSLog the contentsOfCSVFile all data is encrypted. Can any body help? How to apply encoding and decoding?

  • 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-23T17:31:47+00:00Added an answer on May 23, 2026 at 5:31 pm

    All you are doing is copying the exact content of the xls file to a new file with .csv on the end. Changing the file extension does not convert the file format automatically. You need to put a bit in between

    NSData *data = [NSData dataWithContentsOfFile:xlsFilePath];
    

    and

    if([csvFile createFileAtPath:csvFilePathLoc contents:data attributes:nil])
    

    that parses the data as an Excel file and turns it into a CSV file. This is probably a non trivial exercise. Best of luck.

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

Sidebar

Related Questions

From what I've already read this appears to be impossible, but I wanted to
I wanted to read version information of my application from the plit file. For
What I actually wanted to do is read zip file and then if it
I've to read program log file and to do that I wanted to use
I have read this post and I wanted to use ControllerExtensions.RedirectToAction method. But I
I am attempting to read a large XML document and I wanted to do
In a program that I'm writing, I wanted to make a ConfigParser that's read
I wanted to show the users Name Address (see www.ipchicken.com ), but the only
I wanted to generate one fix view using interface builder, but the size of
Im stuck in Excel 2007, running a query, it worked until I wanted to

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.