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. C#
  4. reading data from exxcel

reading data from exxcel

Scheduled Pinned Locked Moved C#
help
2 Posts 2 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.
  • R Offline
    R Offline
    ramyanaidu
    wrote on last edited by
    #1

    I have run the program given below but iam not getting the values from excel can anyone help me out in this plz using System; using Excel; namespace TestExcel { /// /// Summary description for ExcelApplication. /// class ExcelApplication { /// /// The main entry point for the application. /// [STAThread] static void Main(string[] args) { string Path = @"D:\book1.xls"; // initialize the Excel Application class Excel.ApplicationClass app = new ApplicationClass(); // create the workbook object by opening the excel file. Excel.Workbook workBook = app.Workbooks.Open(Path, 0, true, 5, "", "", true, Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0); // get the active worksheet using sheet name or active sheet Excel.Worksheet workSheet = (Excel.Worksheet)workBook.ActiveSheet; string[] name = {"SPACE_REF","LOCAL_SPACE_NAME","SPACE_AREA","SPACE_USE","CAT_CODE","SUB_CAT_CODE","SCHOOL_USE", "NIA","EXCLUDED_%","SUFFICIENCY_SPACE_TYPE","SUFFICIENCY_STAUS_CODE","CEILING_HEIGHT","CEILING_TYPE", "FLOOR_TYPE","CLN_SPEC","CLN_BY","FLOOR_REF","BUILDING_REF","SHARED_SPACE","SHARED_REF","SI_SKETCH_NO", "UPRN","LMS%"}; int l; l = name.Length; for (int a =1; a

    J 1 Reply Last reply
    0
    • R ramyanaidu

      I have run the program given below but iam not getting the values from excel can anyone help me out in this plz using System; using Excel; namespace TestExcel { /// /// Summary description for ExcelApplication. /// class ExcelApplication { /// /// The main entry point for the application. /// [STAThread] static void Main(string[] args) { string Path = @"D:\book1.xls"; // initialize the Excel Application class Excel.ApplicationClass app = new ApplicationClass(); // create the workbook object by opening the excel file. Excel.Workbook workBook = app.Workbooks.Open(Path, 0, true, 5, "", "", true, Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0); // get the active worksheet using sheet name or active sheet Excel.Worksheet workSheet = (Excel.Worksheet)workBook.ActiveSheet; string[] name = {"SPACE_REF","LOCAL_SPACE_NAME","SPACE_AREA","SPACE_USE","CAT_CODE","SUB_CAT_CODE","SCHOOL_USE", "NIA","EXCLUDED_%","SUFFICIENCY_SPACE_TYPE","SUFFICIENCY_STAUS_CODE","CEILING_HEIGHT","CEILING_TYPE", "FLOOR_TYPE","CLN_SPEC","CLN_BY","FLOOR_REF","BUILDING_REF","SHARED_SPACE","SHARED_REF","SI_SKETCH_NO", "UPRN","LMS%"}; int l; l = name.Length; for (int a =1; a

      J Offline
      J Offline
      Jimmanuel
      wrote on last edited by
      #2

      I'm not an expert at the Excel stuff but two things that stick out at me are a) inside the while loop workSheet.Cells is being indexed with 1,1 for every iteration of the loop instead of i and j b) also inside the loop the call to console.writeline is printing spaces, the string should be "{0}" maybe that'll help . . .

      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