on 06-19-2009 9:53 AM
Hi,
I am working on sandbox i need to upload a CSV file residing on my local machine on to the sandbox server using java coding.
plz help me with the solution.
Regards
Savitha
Hi savitha,
Try this code
try { // file writing
String mysheet = "My Sheet";
String mPath = "./temp/"; //(Absolute path)
String file_name ="filename";
File file = new File(mPath + file_name + ".csv");
BufferedWriter mOut = new BufferedWriter(new FileWriter(file));
mOut.write("\"H\",");
mOut.flush();
mOut.close(); //file writing ends
}catch(Exception e)
{
}
try { // file reading
FileInputStream mFileIn = new FileInputStream(file);
byte mBytes[] = new byte[mFileIn.available()];
mFileIn.read(mBytes, 0, mBytes.length);
mFileIn.close();
} catch (FileNotFoundException fileNotFoundException) {
throw new BusinessException(" Unable to find the CSV file");
}
Hope this helps you..
Regards,
Saleem
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
9 | |
8 | |
6 | |
6 | |
6 | |
5 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.