Read an excel file and convert to a 1-D array of long, 32-bit integer?

My vi right now reads an column of numbers as a 1-D array, but I need to input the numbers manually, and for what I'm trying to do, there could be anywhere between 100 to 500 numbers to input. I want the vi to be able to read the excel file and use that column of numbers for the rest, which the data type is long (32-bit integer).
I have an example vi that is able to get excel values, but the output data type is double (64-bit real).
I need to either be able to convert double(64-bit real) data to long (32-bit integer), or find another way to get the values from the excel file.

Just to expand on what GerdW is saying.  There are many programs that hold exclusive access to a file.  So if a file is opened in Excel, the LabVIEW cannot access the file.
What is the exact error code?  Different error codes will point to different issues.
Make sure the csv file is exactly where you think it is and LabVIEW is pointing to the right place.  (I'm just going through stupid things I have done)
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines

Similar Messages

  • Reading in any file and converting to a byte array

    Okay what I am trying to do is to write a program that will read in any file and convert it into a int array so that I can then manipulate the values of the int array and then re-write the file. Once I get the file into an int array I want to try and compress the data with my own algorithm as well as try to write my own encryption algorithm.
    What I have been looking for is code samples that essentially read in the file as a byte array and then I have been trying to convert that byte array into an int array which I could then manipulate. So does anyone have any sample code that essentially takes a file and converts it into an int array and then converts it back into a byte array and write the file. I have found code that is close but I guess I am just too new to this. Any help would be appreciated.

    You can read a whole file into a byte array like this:File f = new File("somefile");
    int size = (int) f.length();
    byte[] contents = new byte[size];
    DataInputStream in = new DataInputStream(
                              new BufferedInputStream(new FileInputStream(f)));
    in.readFully(contents);
    in.close();Note that you need to add in the proper exception handling code. You could also use RandomAccessFile instead of the DataInputStream.
    Writing a byte array to a file is easier; just construct the FileOutputStream, call write on it with the byte array, and close the stream.

  • How can one  read a Excel File and Upload into Table using Pl/SQL Code.

    How can one read a Excel File and Upload into Table using Pl/SQL Code.
    1. Excel File is on My PC.
    2. And I want to write a Stored Procedure or Package to do that.
    3. DataBase is on Other Server. Client-Server Environment.
    4. I am Using Toad or PlSql developer tool.

    If you would like to create a package/procedure in order to solve this problem consider using the UTL_FILE in built package, here are a few steps to get you going:
    1. Get your DBA to create directory object in oracle using the following command:
    create directory TEST_DIR as ‘directory_path’;
    Note: This directory is on the server.
    2. Grant read,write on directory directory_object_name to username;
    You can find out the directory_object_name value from dba_directories view if you are using the system user account.
    3. Logon as the user as mentioned above.
    Sample code read plain text file code, you can modify this code to suit your need (i.e. read a csv file)
    function getData(p_filename in varchar2,
    p_filepath in varchar2
    ) RETURN VARCHAR2 is
    input_file utl_file.file_type;
    --declare a buffer to read text data
    input_buffer varchar2(4000);
    begin
    --using the UTL_FILE in built package
    input_file := utl_file.fopen(p_filepath, p_filename, 'R');
    utl_file.get_line(input_file, input_buffer);
    --debug
    --dbms_output.put_line(input_buffer);
    utl_file.fclose(input_file);
    --return data
    return input_buffer;
    end;
    Hope this helps.

  • Read a excel file and split its sheets to seperate file ?

    Dear all :
    How to split a excel file into several file, each have one sheet.my code is as below,thanks:
    import org.apache.poi.hssf.usermodel.*;
    import java.io.*;
    import java.util.*;
    import org.apache.poi.poifs.filesystem.*;
    public class Extractxls {
    public static void main(String[] args) throws Exception
    try {
    POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream(args[0]));
    HSSFWorkbook wb = new HSSFWorkbook(fs);
    int sheetCount = wb.getNumberOfSheets();
    System.out.println(sheetCount);
    try {
         while(sheetCount > 0) {
         sheetCount--;
         HSSFWorkbook wb1 = new HSSFWorkbook();
         HSSFSheet s = wb1.createSheet();
         String sheetName = wb.getSheetName(sheetCount);
         HSSFSheet sheet = wb.getSheet(sheetName);
    //     HSSFSheet sheet = wb.getSheetAt(sheetCount);
         System.out.println(sheet.toString());
         s = sheet;
    FileOutputStream fileOut = new FileOutputStream("atest" + sheetCount + ".xls");
    wb.write(fileOut);
    fileOut.close();
    } catch (Exception e) {
         System.err.println("Error: " + e.getMessage());
    } catch (Exception e) { e.toString();}

    The HSSFWorkbook class is part of the POI project:
    http://jakarta.apache.org/poi/
    Regards,
    Dave Gilbert
    JFreeChart Project Leader
    I understand poi porject, my problem is that POI can not read a excel file and split its sheets into seperate file (each have one sheet) ?Does any one know how to do it.

  • How to  read from excel file and write it using implicit jsp out object

    our code is as below:Please give us proper solution.
    we are reading from Excel file and writing in dynamicaly generated Excel file.it is writing but not as original excel sheet.we are using response.setContentType and response.setHeader for generating pop up for saveing the original file in to dynamically generated Excel file.
    <%@ page contentType="application/vnd.ms-excel" %>
    <%     
         //String dLoadFile = (String)request.getParameter("jspname1");
         String dLoadFile = "c:/purge_trns_nav.xls" ;
         File f = new File(dLoadFile);
         //set the content type(can be excel/word/powerpoint etc..)
         response.setContentType ("application/msexcel");
         //get the file name
         String name = f.getName().substring(f.getName().lastIndexOf("/") + 1,f.getName().length());
         //set the header and also the Name by which user will be prompted to save
         response.setHeader ("Content-Disposition", "attachment;     filename="+name);
         //OPen an input stream to the file and post the file contents thru the
         //servlet output stream to the client m/c
              FileInputStream in = new FileInputStream(f);
              //ServletOutputStream outs = response.getOutputStream();
              int bit = 10;
              int i = 0;
              try {
                        while (bit >= 0) {
                        bit = in.read();
                        out.write(bit) ;
    } catch (IOException ioe) { ioe.printStackTrace(System.out); }
              out.flush();
    out.close();
    in.close();     
    %>

    If you want to copy files as fast as possible, without processing them (as the DOS "copy" or the Unix "cp" command), you can try the java.nio.channels package.
    import java.nio.*;
    import java.nio.channels.*;
    import java.io.*;
    import java.util.*;
    import java.text.*;
    class Kopy {
         * @param args [0] = source filename
         *        args [1] = destination filename
        public static void main(String[] args) throws Exception {
            if (args.length != 2) {
                System.err.println ("Syntax: java -cp . Kopy source destination");
                System.exit(1);
            File in = new File(args[0]);
            long fileLength = in.length();
            long t = System.currentTimeMillis();
            FileInputStream fis = new FileInputStream (in);
            FileOutputStream fos = new FileOutputStream (args[1]);
            FileChannel fci = fis.getChannel();
            FileChannel fco = fos.getChannel();
            fco.transferFrom(fci, 0, fileLength);
            fis.close();
            fos.close();
            t = System.currentTimeMillis() - t;
            NumberFormat nf = new DecimalFormat("#,##0.00");
            System.out.print (nf.format(fileLength/1024.0) + "kB copied");
            if (t > 0) {
                System.out.println (" in " + t + "ms: " + nf.format(fileLength / 1.024 / t) + " kB/s");
    }

  • How to read an ascii file and record data in a 2d array

    HI everyone,
    I have an experimental data file in ascii format. It contains 10 data sets.
    I'm trying to read the ascii file and record data in a 2d array for further analysis,
    but I still could not figure it out how to do it.
    Please help me to get this done.
    Here I have attaced the ascii file.
    -Sam
    Attachments:
    data.asc ‏123 KB
    2015-01-27_18-01-31_fourier_A2-F-abs.zip ‏728 KB

    Got it!
    Thank you very much !
    -Pamsath

  • Read in a file and convert into Binary

    Hi there, i am new to java so plz give me a hand on this problem.
    I am suppose to read in a file(with whole bunch of different records), and what i need to do is convert the file into binary.....how do i do that??
    the original Q asked:
    Create a java program that will read the products file and write the products data into a java binary file. Adhere to good data typing conventions. That means, if a column in the input file is of type integer, then the data in that column should also be written to the output file in integer format. Same thing for String...
    Here is the code i have so far
    import java.io.*;
    class FileIO {
    /* Main method */
    public static void main(String[] args) throws IOException {
         FileReader file1 = new FileReader("test.txt");
         BufferedReader fileInput = new BufferedReader(file1);
         FileWriter file2 = new FileWriter("test1.txt");
         PrintWriter fileOutput = new PrintWriter(file2);
         String text;
         text = fileInput.readLine();
         //toBinaryString(text); <---i think there is something to do with the tobinary string but i am not sure
              System.out.println(text);
              fileOutput.println(text);
         // Close file
         fileInput.close();
         fileOutput.close();
    E-mail me directly if it's possible, thanks a lot~!!!!!

    Maybe not the answer the teacher is looking for, but I'd be highly tempted to point out that the file, regardless of what's in it, is already binary. Even if it's a text file, what do you think the characters are defined as? Bytes.

  • Read linux lastlog file and convert to a String

    Hi
    I am trying to read the data from the lastlog file in Linux. I think this is a binary file encoded in ASCII. How would I go about reading this file and converting the binary data into a String and then displaying the data? Each bit of data is separated by a new line to distinguish between the different values.
    Many Thanks
    Sambo

    "Binary file encoded in ASCII"? Well, you'd have to find out what encoding was used and then reverse is.
    As for reading files in general, check here:
    http://java.sun.com/docs/books/tutorial/essential/io/index.html

  • BO Data Services - Reading from excel file and writing to SQL Server Table

    Hi,
    I would like to read data from an excel file and write it to a SQL Server Data base table without making any transformations using Data Services. I have created an excel file format as source and created target table in SQL Server. The data flow will just have source and target. I am not sure how to map the columns between source and target. Appreciate your quick help in providing a detailed steps of mapping.
    Regards,
    Ramesh

    Ramesh,
    were you able to get this to work? if not, let me know and I can help you out with it.
    Lynne

  • Read word/excel doc and convert to pdf

    Can any one suggest a way or source to read a word/excel document and convert it to an PDF.. using Java

    Parse the Excel document with the Apache POI API and generate a PDF document with the Apache FOP API.

  • Read from .txt file and output the content as two arrays

    I am using the contoured move to control the x-y stage. The trajectory datas for x and y axis are generated using my interpolation program and it is stored in a .txt file as two columns. What I want to do is read .txt file and output the content of this file as two arrays. Is there anyone has any ideas? Thanks, the .txt file is attached.
    Attachments:
    R.75.txt ‏172 KB

    Hi Awen,
    This is quite easy to do, you can merely use the "read from spreadsheet file" function to get a 2D array (2 columns and n rows) and then use the index array function to get whatever row/colums you want..
    Hope the attached VI helps you
    When my feet touch the ground each morning the devil thinks "bloody hell... He's up again!"
    Attachments:
    read sprdsheet file.vi ‏27 KB

  • How to read an Excel File AND SEND TO GENERATOR

    Hi 
    I want send the datas from Exel file to my device, I have one part in mu code which can read my data from exel but I don t know how can I send this data to ny divice?
    I  really nead your suggestion, please.
    I attached my code also my Exel file.
    Attachments:
    DG5071.xlsx ‏1841 KB
    Rigol Generator.vi ‏52 KB

    Hello vsa,
    I checked the specifications of this Function Arbitrary Waveform Generator and I found that it is GPIB complaint. Instruments with GPIB protocol can be controlled using GPIB commands, but each instrument could have different GPIB commands. Despite this, most providers have "standard" commands among its products.
    I checked some documentation and found a help file that describes the GPIB commands used by this device, so the options are:
    1. Wait for someone to develop an Instrument Driver for this instrument.
    2. Check if you find any other Function Arbitrary Waveform Generator of the same brand that uses the same commands and for which there is already an instrument driver.
    3. Create your own instrument driver.
    If you choose option 3 I share with you the following links that you may find useful:
    Developing LabVIEW Plug and Play Instrument Drivers:
    http://www.ni.com/white-paper/3271/en/
    Connecting Instruments via GPIB:
    http://www.ni.com/getting-started/set-up-hardware/instrument-control/gpib-connect
    GPIB Instrument Control Tutorial:
    http://www.ni.com/white-paper/2761/en/
    Using IVI Drivers in LabVIEW:
    http://www.ni.com/white-paper/4556/en/
    Instrument Control in LabVIEW Tutorial:
    http://www.ni.com/white-paper/3511/en/
    Best regards.
    David P.
    National Instruments
    Applications Engineer
    www.ni.com/soporte
    Attachments:
    DG5000 Programming Guide.zip ‏907 KB

  • How do I read from a file and store the information in an array?

    Here is my problem:
    I am going to have to use a bufferedReader to read a file containing information on 10 vehicles. And after I read that file I want to store the info in Vehicle [] V.
    Where should I start?
    Thanks
    Steve

    Thank you for the quick response.
    As of right now our code is the same. Now I have to "parse" the information. What exactly do you mean?
    My code is as follows:
    while((str = br.readLine()) != null)
    String[] tokenArray = str.split(" ");
    for(int i = 0; i < tokenArray.length; i++)
    System.out.print(" Token: " + tokenArray);
    System.out.println("\n");
    Is that what you mean by parsing?
    I am not quite sure what e slpit(" ") is doing. Is there a better way?
    And just to make sure I am understanding my own code, I am storing the information from the br in tokenArray. Followed by a series of print statements which output the info.Correct?
    Thanks again,
    Steve                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Reading an EXCEL file from Oracle PL/SQL (HP-Unix server)

    Hi,
    I have the following requirement:
    1. Get the EXCEL file from the remote FTP location
    2. Read the EXCEL file and convert it into the CSV file format.
    3. Put the CSV file into another FTP location.
    I need to get all these points done using Oracle PL/SQL procedure.
    I am using the Oracle 9i installed in HP-Unix environment.
    Please help me in getting this done.
    Thanks

    Ok, setting up Excel as an External Database connection....
    1- Go to Control Panel>Administrative Tools>Data Sources (ODBC)>System DSN and create a data source with appropriate driver. Name it EXCL.
    2- In %ORACLE_HOME%\Network\Admin\Tnsnames.ora fie add entry:
    EXCL =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 10.12.0.24)(PORT = 1521))
    (CONNECT_DATA =
    (SID = EXCL)
    (HS = OK)
    Here SID is the name of data source that you have just created.
    3- In %ORACLE_HOME%\Network\Admin\Listener.ora file add:
    (SID_DESC =
    (PROGRAM = hsodbc)
    (SID_NAME = <hs_sid>)
    (ORACLE_HOME = <oracle home>)
    under SID_LIST_LISTENER like:
    SID_LIST_LISTENER =
    (SID_LIST =
    (SID_DESC =
    (SID_NAME = PLSExtProc)
    (ORACLE_HOME = d:\ORA9DB)
    (PROGRAM = extproc)
    (SID_DESC =
    (GLOBAL_DBNAME = ORA9DB)
    (ORACLE_HOME = d:\ORA9DB)
    (SID_NAME = ORA9DB)
    (SID_DESC =
    (PROGRAM = hsodbc)
    (SID_NAME = EXCL)
    (ORACLE_HOME = D:\ora9db)
    Dont forget to reload the listener
    c:\> lsnrctl reload
    4- In %ORACLE_HOME%\hs\admin create init<HS_SID>.ora. For our sid EXCL we create file initexcl.ora.
    In this file set following two parameters:
    HS_FDS_CONNECT_INFO = excl
    HS_FDS_TRACE_LEVEL = 0
    5- Now connect to Oracle database and create database link with following command:
    SQL> CREATE DATABASE LINK excl
    2 USING 'excl'
    3 /
    Database link created.
    Now you can perform query against this database like you would for any remote database.
    SQL> SELECT table_name FROM all_tables@excl;
    TABLE_NAME
    DEPT
    EMP
    But you're limited to Windows based servers for this.
    As for converting Excel to CSV and doing it yourself. I hope you know the internal format of MS Excel files cos you're gonna need to know it. It would be far easier if the "user" creating the Excel file could save a copy out in CSV format for you and then it's just a case of FTP'ing the file and using external tables to read the data.

  • Read Excel file and populate in a Table

    Hi,
    I have a requirement in which i have to read a Excel file and populate it thoroughly in a Table. The rows and column numbers are uncertain.
    Help me on this...
    Regards,
    Krish

    Hi,
    I can give solution to Upload Excel file.
    1)Add jxl jar folder in the lib folder of ur project.
    2)Go to properties of ur project and add jar to ur project.
    3)Using the File upload ui ,browse and upload the file.
    4)Write the read file in to ur server location using fileoutput stream.
    5)then using code u can read the excelfile from the server location itself.
    Here is the code:
    IWDAttributeInfo attInfo =wdContext.getNodeInfo().getAttribute("upload");
    binaryType=IWDModifiableBinaryTypeattInfo.getModifiableSimpleType();
    fileuploaded = binaryType.getFileName();
    byte b[] = wdContext.currentContextElement().getUpload();
    File filename =new File("
    <Server name>\<folde name>\" + fileuploaded);
    try {
    FileOutputStream out = new FileOutputStream(filename);
    out.write(b);
    out.close();
    catch (FileNotFoundException e)
    e.printStackTrace();
    catch (IOException e)
    e.printStackTrace();
    int iRows = 0;
    try {     
    Workbook wb = null;
         Sheet sheet = null;
         wb = Workbook.getWorkbook(filename);
         sheet = wb.getSheet(0);
         int iColumns = sheet.getColumns();
          iRows = sheet.getRows();
         int i = 0;
        for (int r = 0; r < iRows; r++)
       for (int c = 0; c < iColumns; c++)
         Cell cell = sheet.getCell(c, r);
         characterarray<i> = cell.getContents();
    i++;
    wb.close();
    Declare Globally
    //@@begin others
    String fileuploaded;
    IWDModifiableBinaryType binaryType;
    String characterarray[] = new String [10];
    //@@end
    Thanks,
    Durga Rao

Maybe you are looking for

  • I want to use 2 screens on a mac mini, which cable di have to buy extra

    I want to buy the mac mini but i am not sure what extra cable to use to work with 2 screens from Dell.(DVI).

  • Where can I download an older version of ibooks for my 2nd gen touch?

    My Ipod touch crashed, then when I tried to restore from a back up it said the back up was corrupt! I now have no way of reading any of my books. When I move my books from Itunes to my ipod I get a message telling me that I must install Ibooks to rea

  • TS4009 iCloud storage on old MacBook Pro

    I am currently running Mac OS X version 10.6.8 and cannot upgrade due to my old processor. I have rigged my old Mail program to accept my iCloud emails, but do not have an iCloud button in my Preferences. I recently got the message that I was being d

  • Navigation Masterhead Iview

    Hi, I want remove the text 'Welcome' in the Navigation Masterhead Iview (It's the Iview where show 'Welcome Jean François'. I've looked in the server: ootweb-infportalportalappscom.sa.porta.navigation.masterheadprivateclasses headeriview_nls_es.propi

  • Cross Domain Data Source Error in SSRS 2008

    We have our data warehouse server on a different Windows domain (Domain ABC) to the domain where our end user tools such as SSRS and SSAS sit (DOMAIN 123).  Historically we've used SQL server mixed mode authentication to get around any cross domain a