How to save a csv file in a local directory

I am trying to save a regular csv file in a local directory. Any suggestions of how I should approach it. And also I was wondering how I would email that csv file to multiple users

Use a PrintWriter and a FileOutputStream. Look in javax.mail.* for API's to do mailing, or open a socket connection to a pop server and post it.
Posting these kind of questions to "new to java" might be more appropriate...

Similar Messages

  • How to save a .csv file to database server

    Hi every body,
    I need to upload a .csv file from the client machine and save it to a directory in a database sever.
    I could do the uploading part. Can anyone tell me how to save the file?
    Another option is save the file as a CLOB in a database column. But I'm not aware of doing that too.
    Please guide me.
    Thanks in advance.
    Surangi.

    See Steve Muench's Not Yet Documented Example #85 at http://radio.weblogs.com/0118231/stories/2004/09/23/notYetDocumentedAdfSampleApplications.html#85. While this is for 10.1.3, this is still relevant for 11g. Steve's example is for uploading to a BLOB - same thing for a CLOB. Once your data is in the database, you can use the DBMS_LOB package to write the file to a directory on the database server, if you like.
    Also the Developers Guide is your friend - Chapter 9.9 in the Fusion Web User Interface Developers Guide for Oracle ADF 11g, or 19.6 in the ADF Developers Guide for Forms/4GL Developers for JDeveloper 10.1.3.

  • Save a csv file on local host, executing a DTP Open hub in a Process chain?

    Hi All,
    my client has asked me to try if there is a way to save in the local host c:\  a .CSV file generated from an Open HUB executed by a DTP in a Process chain.
    when i execute my DTP it work correctly and it save the .csv file on my c:\ directory.
    my client doesn't want to give th users authtorization on RSA1 and want to try if there is a way to put the DTP in a process chain
    and when executing the process chain every user can have the file on his own local c:\ directory.
    i tried this solution but it doesn't work i get an error on executin the process chain:
    Runtime Errors         OBJECTS_OBJREF_NOT_ASSIGNED
    Except.                     CX_SY_REF_IS_INITIAL
    Error analysis
        An exception occurred that is explained in detail below.
        The exception, which is assigned to class 'CX_SY_REF_IS_INITIAL', was not
         caught in
        procedure "FILE_DELETE" "(METHOD)", nor was it propagated by a RAISING clause.
        Since the caller of the procedure could not have anticipated that the
        exception would occur, the current program is terminated.
        The reason for the exception is:
        You attempted to use a 'NULL' object reference (points to 'nothing')
        access a component (variable: "CL_GUI_FRONTEND_SERVICES=>HANDLE").
        An object reference must point to an object (an instance of a class)
        before it can be used to access components.
        Either the reference was never set or it was set to 'NULL' using the
        CLEAR statement.
    can you give some advices please?
    Thanks for All
    Bilal

    Hi Bilal,
    Unfortunately, DTPs belonging to Open Hubs wich are targeted to a local workstation file, can't be executed through a process chain. 
    The only way of including such DTP in a process chain is changing the Open Hub so that it writes the output file in the application server.  Then, you can retrieve the file -through FTP or any other means- from the application server to the local workstation.
    Hope this helps.
    King regards,
    Maximiliano

  • Simple save as .csv file

    Hi,
    is it possible to simplyfie the save as .csv file dialog? etc. by using filedialog in vba?
    each time i save as .csv i need to say yes to save in older format, select wich map i want to use...
    if i in VBA could have som file dialog brosing to the file i want to use etc.:
    stringtosave = "c:\testfiles\test.csv"
    and then call:
    FileSaveAs Name:=stringtosave , FormatID:="MSProject.CSV", map:="MapiwillUse"
    Regards
    Toni

    Hello Toni,
    I haven't had time to test this myself (it's Saturday!), but i suspect if you bracket your FileSaveAs command turning the MS Project alerts off and back on again, the alert box you're seeing will be suppressed:
    Application.DisplayAlerts = False
    FileSaveAs Name:=stringtosave , FormatID:="MSProject.CSV", map:="MapiwillUse"
    Application.DisplayAlerts = True
    If you wanted to get a dialogue to browse for the folder, you'll need to use an API call. Chip Pearson has posted a how to guide on how to browse for a folder using the API call "SHBrowseForFolderA". His website focusses on MS Excel VBA, but I've
    used this code myself in MS Project and can confirm it works the same.
    http://www.cpearson.com/excel/browsefolder.aspx
    ####Update####
    Rereading your question after posting my response, I think you'll want to browse for a file rather than a folder, which is a different api call - "ahtCommonFileOpenSave".
    I did a quick google search and the clearest example I came across was this one - again, not written for MS Project, but the code is the same:
    http://access.mvps.org/access/api/api0001.htm
    Andrew

  • Please can someone tell me how to save a MP3 file from my email on my iPad so I can put in on Facebook? Thankyou

    Please can someone tell me how to save a MP3 file from my email on my iPad so I can put it on Faceboo? I use hotmail and please tell me step by step as I am not a tech guru lol. Thankyou

    Hi jscher200,
    Thank you for your reply, sorry for the VERY late late response, but I have just figured out how to control this separate 'panel'. I find it really useful for monitoring Google Analytics in as it can just sit there running. It does have its limitations, as it's a limited size (you can't expand it to full screen view), so you can only ever see a vertical section of a website and need to scroll to look to the right or left, but I have the live view of people accessing my website running on there and if the numbers start racking up at any time, I can scroll to look and see what pages they are accessing, where they've been referred from, etc.
    To get it to work, you save a website address in the Bookmarks Toolbar and when you can see it sitting on the toolbar at the top of the screen with its little icon, right click on it then click 'properties', then tick the box 'Load this bookmark in the sidebar'. The next time you click on this bookmark to open the website, it will load in this sidebar, which looks like a separate 'window' but is immovable. You can only have one sidebar application running at a time, but can change it by right clicking on the bookmark you want to load in there and it will then change to that one next time you click on that bookmark.
    I hope this might be useful to others, as I asked for help with this on loads of forums and not one person knew that this existed - even really skilled techies!

  • How to graph a CSV file in VB

    Hi, so I have a CSV file in my working directory and dont know how to load in into a graph in VB. I already loaded my chart into the form and its called "Chart1" with "Series1".
    The CSV has the following structure:
    Date Value1 Value2
    27/04/2012 45.1 60.1
    26/04/2012 45.2 60.2.. ..
    I cant figure out how to extract this data from the "*.csv" file and put in it a graph where the
    Date is the x axis and the
    Value2 is the y axis.
    Any code would be greatly appreciated!

    Is the CSV file data in reverse date order?  Your example includes only two lines, so the sequence is not clear.
    If so, then you want to add the items to the series by working from the end of the file towards the beginning of the file. That would plot the points along the x-axis in order of increasing date.  Is that correct?
    But then you say that you want to plot from the beginning to a certain date. Do you mean that you want to plot (reversed) from the beginning of the file to a certain nominated ending date? Or do you want to plot the items starting at the end of the file
    and working backwards through the file so that the plot starts at a nominated starting date?  I have assumed the former.
    To adjust the above code for these new requirements you should load the data into an object that you can manipulate to your requirements.  Then you need to separate the plotting from the file access.  A list is more suitable than an array.
    Dim Readings As List(Of Reading) = New List(Of Reading)
    Dim StartDate As Date = New Date(2012, 4, 24)
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Dim CurrentPoint As Integer = 0
    Using MyReader As New Microsoft.VisualBasic.FileIO.TextFieldParser("C:\Users\Public\Readings.txt")
    MyReader.TextFieldType = Microsoft.VisualBasic.FileIO.FieldType.Delimited
    MyReader.Delimiters = New String() {","}
    Dim currentRow As String()
    While Not MyReader.EndOfData
    Try
    currentRow = MyReader.ReadFields()
    Dim D As String = currentRow(0)
    Try
    Dim Y As Double = CDbl(currentRow(2))
    Readings.Add(New Reading(D, Y))
    Catch ex As InvalidCastException
    If CurrentPoint <> 0 Then
    MsgBox("Item " & currentRow(2) & " is invalid. Skipping")
    End If
    End Try
    Catch ex As Microsoft.VisualBasic.FileIO.MalformedLineException
    If CurrentPoint <> 0 Then
    MsgBox("Line " & ex.Message & " is invalid. Skipping")
    End If
    End Try
    End While
    End Using
    Readings.Reverse()
    CurrentPoint = 0
    Chart1.Series(0).Points.Clear()
    For Each R As Reading In Readings
    Dim D As Date = CDate(R.Read_Date)
    If D >= StartDate Then
    Chart1.Series(0).Points.AddY(R.Read_Data)
    Chart1.Series(0).Points(CurrentPoint).AxisLabel = R.Read_Date
    CurrentPoint += 1
    End If
    Next
    End Sub
    That code uses the following class:
    Public Class Reading
    Public Read_Date As String
    Public Read_data As Double
    Public Sub New(ByVal Item1 As String, ByVal item2 As Double)
    Read_Date = Item1
    Read_data = item2
    End Sub
    End Class
    I know this thread is a couple years old but I tried this code and it works in Studio 2013 Community and it is very close to what I need. I want to make it a line chart and I want to have 4 series- Temp, Temp_SP, RH% and RH%_SP so I can log some trending
    data from an environmental chamber at work. Can someone help me out with this?
    Thanks,
    Dan

  • How to create a CSV file in java

    how to create a CSV file in java

    this is the code that I have used in a hp project:
    private static final String DELIMIT = ",";
    StringBuffer buf = new StringBuffer();
    public void addString(String str){
    buf.append(toEscapedStringLiteral(str.replaceAll(" ","").trim())).append(DELIMIT);
    public void sendFile( String strData ,
                                String strTitle,
                                String strContType,
                                HttpServletResponse res ) throws IOException {
              byte[] _filedata=strData.getBytes();
              res.setContentType( strContType );
              res.setHeader( "Content-Disposition", "attachment;filename="+ strTitle );     
                     DataOutputStream out = new DataOutputStream( res.getOutputStream() );
              out.write( _filedata, 0, _filedata.length );
              out.close();
    public void addStringWhithReturn(String str){
              buf.append(toEscapedStringLiteral(str.replaceAll(" ","").trim()));
              buf.append( "\n" );
    private String toEscapedStringLiteral( String charSeq ) {
              if ( null == charSeq ) {
                   charSeq = "";
              return "\"" + charSeq + "\"";
    ....hope its help
    kou

  • How to save as Excel file type?

    There were no Excel file type under the "Save As" function.  Is there anyway to include Excel file type under this list?  Snapshot attached. 
    Solved!
    Go to Solution.
    Attachments:
    Export_file_types.png ‏28 KB

    Hi NiCoder,
    You have a numer of different options to get data from the DIAdem Data Portal to Excel:
    1)  Save to TDM or TDMS file and use the free TDM Excel Importer to load the data into Excel
    2)  Save to CSV file and use Excel's built-in ASCII file import feature to load the data into Excel
    3)  Load the gfsexcel.dll GPI-DLL and use the "File >> Save as..." option to export an *.xls data file
    4)  Use a custom VBScript to automate any of the above 3 options
    5)  Use a custom VBScript to directly send each Data Portal data channel to a column of values in Excel via ActiveX
    Options 1) and 2) are easiest if you want a purely interactive solution.  Option 1) will export all the data values as well as all the properties.  Option 2) will export all the data values and the name of each channel in the Data Portal, but none of the other properties.  If you choose to use option 3), know ahead of time that this feature is limited to 255 columns and will not export any custom properties, just the properties that existed back in DIAdem 8.1.  Option 4) can add in all the custom properties that are missing in option 2).  Option 5) can export all the data and all custom properties, but it is also the slowest option and involves the most programming.
    Let me know what sounds best to you,
    Brad Turpin
    DIAdem Product Support Engineer
    National Instruments

  • How to create a csv file with NCS attributes?

    Hi
    i installed Cisco Prime NCS and trying to perform bulk update of device credentials with csv file.
    How to create a csv file with all required attributes?
    This is part of NCS online help talking about this topic:
    Bulk Update Devices—To update the device credentials in a bulk, select Bulk Update Devices from the Select a command drop-down list. The Bulk Update Devices page appears.You can choose a CSV file.
    Note        The CSV file contains a list of devices to be updated, one device per line. Each line is a comma separated list of device attributes. The first line describes the attributes included. The IP address attribute is mandatory.
    Bellow is test csv file i created but does not work:
    10.64.160.31,v2c,2,10,snmpcomm,ssh,zeus,password,password,enablepwd,enablepwd,60
    10.64.160.31,v2c,2,10,snmpcomm,ssh,zeus,password,password,enablepwd,enablepwd,60
    The error i am getting while importing this file:
    Missing mandatory field [ip_address] on header line:10.64.160.31,v2c,2,10,snmpcomm,ssh,zeus,password,password,enablepwd,enablepwd,60
    Assistance appreciated.

    It looks like the IP address field is incorrectly set.,
    It should be as follows
    {Device IP},{Device Subnet Mask}, etc etc
    so a practical example of the aboove could be (i dont know if this is completely correct after the IP address / Subnet Mask)
    10.64.160.31,255.255.255.0,v2c,2,10,snmpcomm,ssh,zeus,password,password,enablepwd,enablepwd,60
    below is a link to the documentation
    http://www.cisco.com/en/US/docs/wireless/ncs/1.0/configuration/guide/ctrlcfg.html#wp1840245
    HTH
    Darren

  • How to write a CSV file in OSB

    Hi All,
    can any one tell me How to write a CSV file in OSB?
    Thanks.

    Hey, I couldnot find any xsl usage inside pipeline pair in the links given by you. Do you have any links that gives a sample example.I could not find any links with examples. I will send you a simple config jar demonstrating the use of XSLT resources/transformations.
    secondly should MFL doc replicate the name(s)of the nodes of the source xsd:I'm not sure If I understood your question.Can you please explain?
    Ex: My database schema looks like:
    <?xml version = '1.0' encoding = 'UTF-8'?>
    <xs:schema targetNamespace="http://xmlns.oracle.com/pcbpel/adapter/db/top/AssetsPoll" xmlns="http://xmlns.oracle.com/pcbpel/adapter/db/top/AssetsPoll" elementFormDefault="qualified" attributeFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:element name="CountriesCollection" type="CountriesCollection"/>
    <xs:complexType name="CountriesCollection">
    <xs:sequence>
    <xs:element name="Countries" type="Countries" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
    </xs:complexType>
    <xs:complexType name="Countries">
    <xs:sequence>
    <xs:element name="countryId">
    <xs:simpleType>
    <xs:restriction base="xs:string">
    <xs:maxLength value="2"/>
    </xs:restriction>
    </xs:simpleType>
    </xs:element>
    <xs:element name="countryName" minOccurs="0" nillable="true">
    <xs:simpleType>
    <xs:restriction base="xs:string">
    <xs:maxLength value="40"/>
    </xs:restriction>
    </xs:simpleType>
    </xs:element>
    <xs:element name="regionId" type="xs:decimal" minOccurs="0" nillable="true"/>
    </xs:sequence>
    </xs:complexType>
    </xs:schema>
    and the corresponding MFL that I have created gives this output
    <?xml version="1.0" encoding="windows-1252"?>
    <countriesCollection1>
    <Countries>
    <counrtyId>counrtyId</counrtyId>
    <country_name>country_name</country_name>
    <regionId>regionId</regionId>
    </Countries>
    <Countries>
    <counrtyId>counrtyId</counrtyId>
    <country_name>country_name</country_name>
    <regionId>regionId</regionId>
    </Countries>
    </countriesCollection1>
    Why I am asking this beacuse there is an error that i am getting:
    Jun 19, 2009 5:50:50 PM IST> <Error> <JCATransport> <BEA-381951> <JCA inbound r
    quest only invocation failed, exception: java.security.PrivilegedActionExceptio
    : com.bea.wli.sb.transports.TransportException: Binary to XML mfl transformatio
    failed for the MFL Resource Database-Jms-File/Database-File/MFLSample : null
    ava.security.PrivilegedActionException: com.bea.wli.sb.transports.TransportExce
    tion: Binary to XML mfl transformation failed for the MFL Resource Database-Jms
    File/Database-File/MFLSample : null..................................................
    Any help?
    Regards
    PS

  • How to import an .csv file into the database?

    and can we code the program in JSP to import the.csv file into the database.

    It is better to use Java class to read the CSV file and store the contents in the database.
    You can use JSP to upload the CSV file to the server if you want, but don't use it to perform database operations.
    JSPs are good for displaying information on the front-end, and for displaying HTML forms, there are other technologies more suitable for the middle layer, back end and the database layer.
    So break you application into
    1) Front end - JSPs to display input html forms and to display data retrieved from the database.
    2) Middle layer - Servlets and JavaBeans to interact with JSPs. The code that reads the CSV file to parse it's contents should be a Java Class in the middle layer. It makes use of Java File I/O
    3) Database layer - Connects to the database using JDBC (Java Database Connectivity), and then writes to the database with SQL insert statements.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Keeping the above concepts in mind, first build a simple JSP and get it to work,
    then research on Google , for Java File I/O , discover how to read a file,
    Then search on how to readh a CSV file using Java.
    After researching you should be able to read the CSV file line by line and store each line inside a Collection.
    Then research on Google, on how to write to the database using JDBC
    Write a simple program that inserts something to a dummy table in the database.
    Then, read the data stored in the Collection, and write insert statements for each records in the collection.

  • VISA: How to get the CSV file through C/C++ code?

    How to get the CSV file through C/C++ code?
    I'm communicating with a USB oscilloscope using VISA.

    Thank you for your reply.
    I am using Apache Commons File Upload. Here is the code where I got the "fi".
         DiskFileUpload fu = new DiskFileUpload();
              fu.setSizeMax(1000000000);
              List fileItems = fu.parseRequest(request);
             Iterator itr = fileItems.iterator();
              FileItem fi = (FileItem)itr.next();
              if(!fi.isFormField())
                File tempFileRef  = new File(fi.getName());
         System.out.println("Field = "+tempFileRef.getAbsolutePath());
         }

  • How to save the report file in network drive

    Hi experts,
    Can any one of you pls tell me how can  save the report file in network drive.
    My requirement:
    by running a report i wll get daily data into a list.SO, i want to keep this in a common drive (network drive:Z) where every one can acces the txt file.
    I want the code in SAP to design this.
    Awaiting for an early reply.

    Is the Z drive in the application or presentation server ?
    make sure the server has write access to the required folder
    for presentation server
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
        filename              = 'c:\test_xls.xls'
        filetype              = 'ASC'
        write_field_separator = 'X'
      TABLES
        data_tab              = itab.
    for the application server, use
    data: outfile(120).
      OPEN DATASET outfile FOR APPENDING IN TEXT MODE ENCODING DEFAULT.

  • How to save a numbers file to a pdf file of multiple pages instead of one giant long page?

    How to save a numbers file to a pdf file of multiple pages instead of one giant long page?

    Hi DW,
    Numbers 3.2.2
    Instead of Menu > File > Export To,  use Menu > File > Print...
    That takes you to Print Preview.
    In the Print Setup panel, Click on the Print... button lower right (it won't print yet).
    That opens the Print Dialogue.
    Click on the PDF Pop-Up Menu lower left.
    Choose Open PDF in Preview or Save as PDF.
    That will have page breaks and will be full sized.
    Print from Preview.
    Regards,
    Ian.

  • How to load 100 CSV file to DSO / InfoCube

    Hi
    How to load 100 CSV files of transcational data to DSO / InfoCube?

    Hi,
    you can achieve to write the .bat (batch file program in windows)
    .bat program it will convert to xsl to .CSV format.
    in process chain you can use the OS COMMAND option while creating process chain.
    it will first trigger the bat file then it will trigger the excel files and info package.
    now i am also working on same scenario now.
    please find the below doc how to create the process chain using os command.
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/e0c41c52-2638-2e10-0b89-ffa4e2f10ac0?QuickLink=index&…
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/3034bf3d-9dc4-2d10-9e93-d4ba01505ed9?QuickLink=index&…
    Thanks,
    Phani.

Maybe you are looking for