Read csv file and insert the data to a list in sharePoint
Hi everyone,
i wrote a code that reads from a csv file all his data but i need also to insert all the data to a new list in sharePoint.
how can i do this?
plus, i need to read from the csv file once a day in specific hour. how can i do this? thank you so much!!
Did you look at the example I posted above?
ClientContext in CSOM will allow you to get a handle on the SharePoint objects;
http://msdn.microsoft.com/en-us/library/office/ee539976(v=office.14).aspx
w: http://www.the-north.com/sharepoint | t: @JMcAllisterCH | YouTube: http://www.youtube.com/user/JamieMcAllisterMVP
Similar Messages
-
How can i open a DOC or TXT file and insert the data into table?
How can i open a DOC or TXT file and insert the data into table?
I have a doc file . the doc include some columns and some rows.(for example 'ID,Name,Date,...').
I'd like open DOC file and I'd like insert them into the table with same columns.
Thanks.Use the SQL*Loader utility or the UTL_FILE package.
-
How to read XML file and update the data in MS CRM 2011?
Hi Folks,
Can anyone please help me finding some references to read XML files and push the data to MS CRM 2011 preferably by using a console application.
Please let me know if any ways of handling it in simple ways.
Thanks,
SriHI,
How to read XML file:
https://social.msdn.microsoft.com/Forums/en-US/5dd7261b-86c4-4ca8-ba87-95196ef3ba50/need-to-display-xml-file-in-textboxes-edit-the-data-and-save-the-new-xml-file?forum=csharpgeneral
How to work with CRM:
ClientCredentials credentials = new ClientCredentials();
credentials.Windows.ClientCredential = new System.Net.NetworkCredential("USER", "Password", "Domain");
Uri uri = new Uri("http://server/Organization/XRMServices/2011/Organization.svc");
OrganizationServiceProxy proxy = new OrganizationServiceProxy(uri, null, credentials, null);
proxy.ServiceConfiguration.CurrentServiceEndpoint.Behaviors.Add(new ProxyTypesBehavior());
IOrganizationService service = (IOrganizationService)proxy;
//using "service" you can create, update and retrieve entities.
More information here about service functions:
https://msdn.microsoft.com/en-us/library/gg328198.aspx -
// Code Help need .. in Reading CSV file and display the Output.
Hi All,
I am a new Bee in code and started learning code, I have stared with Console application and need your advice and suggestion.
I want to write a code which read the input from the CSV file and display the output in console application combination of first name and lastname append with the name of the collage in village
The example of CSV file is
Firstname,LastName
Happy,Coding
Learn,C#
I want to display the output as
HappyCodingXYZCollage
LearnC#XYXCollage
The below is the code I have tried so far.
// .Reading a CSV
var reader = new StreamReader(File.OpenRead(@"D:\Users\RajaVill\Desktop\C#\input.csv"));
List<string> listA = new List<string>();
while (!reader.EndOfStream)
var line = reader.ReadLine();
string[] values = line.Split(',');
listA.Add(values[0]);
listA.Add(values[1]);
listA.Add(values[2]);
// listB.Add(values[1]);
foreach (string str in listA)
//StreamWriter writer = new StreamWriter(File.OpenWrite(@"D:\\suman.txt"));
Console.WriteLine("the value is {0}", str);
Console.ReadLine();
Kindly advice and let me know, How to read the column header of the CSV file. so I can apply my logic the display combination of firstname,lastname and name of the collage
Best Regards,
Raja Village Sync
Beginer CoderVery simple example:
var column1 = new List<string>();
var column2 = new List<string>();
using (var rd = new StreamReader("filename.csv"))
while (!rd.EndOfStream)
var splits = rd.ReadLine().Split(';');
column1.Add(splits[0]);
column2.Add(splits[1]);
// print column1
Console.WriteLine("Column 1:");
foreach (var element in column1)
Console.WriteLine(element);
// print column2
Console.WriteLine("Column 2:");
foreach (var element in column2)
Console.WriteLine(element);
Mark as answer or vote as helpful if you find it useful | Ammar Zaied [MCP] -
SQL server 2014 and VS 2013 - Dataflow task, read CSV file and insert data to SQL table
Hello everyone,
I was assigned a work item wherein, I've a dataflow task on For Each Loop container at control flow of SSIS package. This For Each Loop container reads the CSV files from the specified location one by one, and populates a variable with current
file name. Note, the tables where I would like to push the data from each CSV file are also having the same names as CSV file names.
On the dataflow task, I've Flat File component as a source, this component uses the above variable to read the data of a particular file. Now, here my question comes, how can I move the data to destination, SQL table, using the same variable name?
I've tried to setup the OLE DB destination component dynamically but it executes well only for first time. It does not change the mappings as per the columns of the second CSV file. There're around 50 CSV files, each has different set off columns
in it. These files needs to be migrated to SQL tables using the optimum way.
Does anybody know which is the best way to setup the Dataflow task for this requirement?
Also, I cannot use Bulk insert task here as we would like to keep a log of corrupted rows.
Any help would be much appreciated. It's very urgent.
Thanks, <b>Ankit Shah</b> <hr> Inkey Solutions, India. <hr> Microsoft Certified Business Management Solutions Professionals <hr> http://ankit.inkeysolutions.comThe standard Data Flow Task supports only static metadata defined during design time. I would recommend you check the commercial COZYROC
Data Flow Task Plus. It is an extension of the standard Data Flow Task and it supports dynamic metadata at runtime. You can process all your input CSV files using a single Data Flow Task
Plus. No programming skills are required.
SSIS Tasks Components Scripts Services | http://www.cozyroc.com/ -
How to read a file and save the contents into array list
i have textfile contains information like:
Name: James Smith
Customer no: 663,282
Post code: BA1 74E
Telephone no: 028-372632
Last modified: Feb 10, 2008 6:50:00 PM GMT
Name: Janet Smith
Customer no: 663,283
Post code: BA1 74E
Telephone no: 028-372632
Last modified: Jan 11, 2007 8:10:05 PM GMT
etc...
how can i read the contents of this textfile and put the data into an ArrayList called ArrayList<Customer> customerList.
i knew that i need two classes, one for CustomerDetails and one for ReadFile.
i have already done the customer class as:
import java.util.Date;
public class Customer
String Name;
int CustomerNo;
String Postcode;
String teleNo;
Date lastModified;
public Customer(String Name, int CustomerNo, String Postcode, String teleNo, Date lastModified)
assign(Name, CustomerNo, Postcode, teleNo, lastModified);
public void assign(String Name, int CustomerNo, String Postcode, String teleNo, Date lastModified)
this.Name=Name;
this.CustomerNo=CustomerNo;
this.Postcode=Postcode;
this.teleNo=teleNo;
this.lastModified=lastModified;
public String toString()
String allDetails = "Name: "+Name+
", Customer No: "+CustomerNo+
", Postcode:"+Postcode+
", Telephone No: "+teleNo+
", Last Modified Date: "+lastModified;
return allDetails;
}i just wondering how can i code the ReadFile class?
can anyone help me please. thank you in advance.thank you for your suggestion, but i have already started to code the readCustomer class using the Scanner.
the code i got so far is:
import java.util.Scanner;
import java.io.*;
public class readCustomer
public static void main(String[] args)
readCustomer("Customers.txt");
public static void readCustomer(String filename)
try {
Scanner scanner = new Scanner(new File(filename));
scanner.useDelimiter(System.getProperty("line.separator"));
while (scanner.hasNext()) {
processLine(scanner.next());
scanner.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
public static void processLine(String line)
Scanner scanner2 = new Scanner(line);
scanner2.useDelimiter("\\s*:\\s*");
String description = scanner2.next();
*// here is where i am struggling. i don't know how to get the information after the : sign*
}i am currently struggling with the processLine method?
also, i am not sure how to group a set of information and put them into the arraylist.
Any hint, please. Thank you.
Edited by: mujingyue on Feb 26, 2008 12:42 PM -
Stage tab delimited CSV file and load the data into a different table
Hi,
I pretty new to writing PL/SQL packages.
We are using Application express for our development. We get CSV files which is stored as a BLOB content in a table. I need to write a trigger that would get executed once the user the uploads the file and parse thru the Blob content and upload or stage the data in a different table.
I would like to see if there is any tutorial or article that could explain the above process with the example or sample code to do the same. Any help in this regard will be highly appreciated.Hi,
This is slightly unusual but at the same time easy to solve. You can read through a blob using the dbms_lob package, which is one of the Oracle supplied packages. This is presumably the bit you are missing, as once you know how you read a lob the rest is programming 101.
Alternatively, you could write the lob out to a file on the server using another built in package called utl_file. This file can be parsed using an appropriately defined external table. External tables are the easiest way of reading data from flat files, including csv.
I say unusual because why are you loading a csv file into a blob? A clob is almost understandable but if you can load into a column in a table why not skip this bit and just load the data as it comes in straight into the right table?
All of what I have described is documented functionality, assuming you are on 9i or greater. But you didn't provide a version so I can't provide a link to the documentation ;)
HTH
Chris -
(Urgent help needed) how to read txt file and store the data into 2D-array?
Hi, I have a GUI which allow to choose file from the file chooser, and when "Read file" button is pressed, I want to show the array data into the textarea.
The sample data is like this followed:
-0.0007 -0.0061 0.0006
-0.0002 0.0203 0.0066
0 0.2317 0.008
0.0017 0.5957 0.0008
0.0024 1.071 0.0029
0.0439 1.4873 -0.0003
I want my program to scan through and store these data into 2D array.
However for some reason, my source code issues errors, and I don't know what's wrong with it, seems to have a problem in StringTokenizer though. Can anybody help me?
Thanks in advance.
import java.io.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.util.StringTokenizer;
public class FileReduction1 extends JFrame implements ActionListener{
// GUI features
private BufferedReader fileInput;
private JTextArea textArea;
private JButton openButton, readButton,processButton,saveButton;
private JTextField textfield;
private JPanel pnlfile;
private JPanel buttonpnl;
private JPanel buttonbar;
// Other fields
private File fileName;
private String[][] data;
private int numLines;
public FileReduction1(String s) {
super(s);
// Content pane
Container cp = getContentPane();
cp.setLayout(new BorderLayout());
// Open button Panel
pnlfile=new JPanel(new BorderLayout());
textfield=new JTextField();
openButton = new JButton("Open File");
openButton.addActionListener(this);
pnlfile.add(openButton,BorderLayout.WEST);
pnlfile.add(textfield,BorderLayout.CENTER);
readButton = new JButton("Read File");
readButton.addActionListener(this);
readButton.setEnabled(false);
pnlfile.add(readButton,BorderLayout.EAST);
cp.add(pnlfile, BorderLayout.NORTH);
// Text area
textArea = new JTextArea(10, 100);
cp.add(new JScrollPane(textArea),BorderLayout.CENTER);
processButton = new JButton("Process");
//processButton.addActionListener(this);
saveButton=new JButton("Save into");
//saveButton.addActionListener(this);
buttonbar=new JPanel(new FlowLayout(FlowLayout.RIGHT));
buttonpnl=new JPanel(new GridLayout(1,0));
buttonpnl.add(processButton);
buttonpnl.add(saveButton);
buttonbar.add(buttonpnl);
cp.add(buttonbar,BorderLayout.SOUTH);
/* ACTION PERFORMED */
public void actionPerformed(ActionEvent event) {
if (event.getActionCommand().equals("Open File")) getFileName();
if (event.getActionCommand().equals("Read File")) readFile();
/* OPEN THE FILE */
private void getFileName() {
// Display file dialog so user can select file to open
JFileChooser fileChooser = new JFileChooser();
fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
int result = fileChooser.showOpenDialog(this);
// If cancel button selected return
if (result == JFileChooser.CANCEL_OPTION) return;
if (result == JFileChooser.APPROVE_OPTION)
fileName = fileChooser.getSelectedFile();
textfield.setText(fileName.getName());
if (checkFileName()) {
openButton.setEnabled(false);
readButton.setEnabled(true);
// Obtain selected file
/* READ FILE */
private void readFile() {
// Disable read button
readButton.setEnabled(false);
// Dimension data structure
getNumberOfLines();
data = new String[numLines][];
// Read file
readTheFile();
// Output to text area
textArea.setText(data[0][0] + "\n");
for(int index=0;index < data.length;index++)
for(int j=1;j<data[index].length;j++)
textArea.append(data[index][j] + "\n");
// Rnable open button
openButton.setEnabled(true);
/* GET NUMBER OF LINES */
/* Get number of lines in file and prepare data structure. */
private void getNumberOfLines() {
int counter = 0;
// Open the file
openFile();
// Loop through file incrementing counter
try {
String line = fileInput.readLine();
while (line != null) {
counter++;
System.out.println("(" + counter + ") " + line);
line = fileInput.readLine();
numLines = counter;
closeFile();
catch(IOException ioException) {
JOptionPane.showMessageDialog(this,"Error reading File",
"Error 5: ",JOptionPane.ERROR_MESSAGE);
closeFile();
System.exit(1);
/* READ FILE */
private void readTheFile() {
// Open the file
int row=0;
int col=0;
openFile();
System.out.println("Read the file");
// Loop through file incrementing counter
try {
String line = fileInput.readLine();
while (line != null)
StringTokenizer st=new StringTokenizer(line);
while(st.hasMoreTokens())
data[row][col]=st.nextToken();
System.out.println(data[row][col]);
col++;
row++;
closeFile();
catch(IOException ioException) {
JOptionPane.showMessageDialog(this,"Error reading File",
"Error 5: ",JOptionPane.ERROR_MESSAGE);
closeFile();
System.exit(1);
/* CHECK FILE NAME */
/* Return flase if selected file is a directory, access is denied or is
not a file name. */
private boolean checkFileName() {
if (fileName.exists()) {
if (fileName.canRead()) {
if (fileName.isFile()) return(true);
else JOptionPane.showMessageDialog(null,
"ERROR 3: File is a directory");
else JOptionPane.showMessageDialog(null,
"ERROR 2: Access denied");
else JOptionPane.showMessageDialog(null,
"ERROR 1: No such file!");
// Return
return(false);
/* FILE HANDLING UTILITIES */
/* OPEN FILE */
private void openFile() {
try {
// Open file
FileReader file = new FileReader(fileName);
fileInput = new BufferedReader(file);
catch(IOException ioException) {
JOptionPane.showMessageDialog(this,"Error Opening File",
"Error 4: ",JOptionPane.ERROR_MESSAGE);
System.out.println("File opened");
/* CLOSE FILE */
private void closeFile() {
if (fileInput != null) {
try {
fileInput.close();
catch (IOException ioException) {
JOptionPane.showMessageDialog(this,"Error Opening File",
"Error 4: ",JOptionPane.ERROR_MESSAGE);
System.out.println("File closed");
/* MAIN METHOD */
/* MAIN METHOD */
public static void main(String[] args) throws IOException {
// Create instance of class FileChooser
FileReduction1 newFile = new FileReduction1("File Reduction Program");
// Make window vissible
newFile.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
newFile.setSize(500,400);
newFile.setVisible(true);
Java.lang.NullpointException
at FileReductoin1.readTheFile <FileReduction1.java :172>
at FileReductoin1.readFile <FileReduction1.java :110>
at FileReductoin1.actionPerformed <FileReduction1.java :71>
.1) Next time use the CODE tags. this is way too much unreadable crap.
2) The problem is your String[][] data.... the only place I see you do anything approching initializing it is
data = new String[numLines][];I think you want to do this..
data = new String[numLines][3];anyway that's why it's blowing up on the line
data[row][col]=st.nextToken(); -
Reading a file and parsing the data for a calculation method
i am trying to read a file with 3 feilds double double and int . am able to read the file but i am getting an exception right befor i parse the data ...code
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.*;
//import com.sun.java.util.jar.pack.Package.File;
public class FileTester {
public static String mLine;
public static void main(String[] args) {
BufferedReader in = null;
try{
File f = new File ("loan.txt.txt");
in = new BufferedReader(new FileReader(f));
catch(FileNotFoundException e)
System.out.println("file does not exist");
System.exit(0);
try{
String mLine = in.readLine();
while (mLine != null){
System.out.println(mLine);
mLine = in.readLine();
}}catch(Exception e)
{System.out.println(e.getMessage());
String []data = mLine.split("\t");
double loan = Double.parseDouble(data[0]);
double interest = Double.parseDouble(data[1]);
int term = Integer.parseInt(data[2]);
System.out.println(loan+interest+term);
afterwards i would like to break this up into three methods to feed the values to a calculation classTake a look at your while loop. It continues to loop as long as mLine != null. Therefore it stops looping when mLine IS = null. So can you now see why the following line of code would cause problems?
String []data = mLine.split("\t");How is the data stored in your file? Is it a single line with the three values separated by a tab? If so you can do away with the while loop and just call readLine() once. Otherwise you will have to process each line you read inside the while loop.
P.S. use the code button when posting code. There is a button above the textfield when use post a reply. -
How can i read the text files and buffer the data in Vector?
hi. I have been running into this problem for days, but with no luck and losing right direction.
The problem is : I am trying to read a text file and buffer the data into a
Queue for each user.
the sample text file is as below:( 1st column is timestamp, 2nd is user_id, 3rd is packet_id, 4th is packet_seqno, 5th is packet_size)
0 1 1 1 512
1 2 1 2 512
2 3 1 3 512
3 4 1 4 512
4 5 1 5 512
5 6 1 6 512
6 7 1 7 512
7 8 1 8 512
8 9 1 9 512
9 10 1 10 512
10 1 2 11 512
11 2 2 12 512
12 3 2 13 512
13 4 2 14 512
14 5 2 15 512
15 6 2 16 512
16 7 2 17 512
17 8 2 18 512
18 9 2 19 512
19 10 2 20 512
20 1 3 21 512
21 2 3 22 512
22 3 3 23 512
23 4 3 24 512
24 5 3 25 512
25 6 3 26 512
26 7 3 27 512
27 8 3 28 512
28 9 3 29 512
29 10 3 30 512
30 1 4 31 512
31 2 4 32 512
32 3 4 33 512
33 4 4 34 512
34 5 4 35 512
35 6 4 36 512
36 7 4 37 512
37 8 4 38 512
38 9 4 39 512
39 10 4 40 512
40 1 5 41 512
41 2 5 42 512
42 3 5 43 512
43 4 5 44 512
44 5 5 45 512
45 6 5 46 512
46 7 5 47 512
47 8 5 48 512
48 9 5 49 512
49 10 5 50 512
50 1 6 51 512
51 2 6 52 512
52 3 6 53 512
53 4 6 54 512
54 5 6 55 512
55 6 6 56 512
56 7 6 57 512
57 8 6 58 512
58 9 6 59 512
59 10 6 60 512
60 1 7 61 512
61 2 7 62 512
62 3 7 63 512
63 4 7 64 512
64 5 7 65 512
65 6 7 66 512
66 7 7 67 512
67 8 7 68 512
68 9 7 69 512
69 10 7 70 512
70 1 8 71 512
71 2 8 72 512
What I wanna do is to read all the data above and buffer them in a queue for each user( there are only 10 users in total).
I already created a class called Class packet:
public class packet {
private int timestamp;
private int user_id;
private int packet_id;
private int packet_seqno;
private int packet_size;
/** Creates a new instance of packet */
public packet(int timestamp,int user_id, int packet_id,int packet_seqno, int packet_size)
this.timestamp = timestamp;
this.user_id=user_id;
this.packet_id=packet_id;
this.packet_seqno=packet_seqno;
this.packet_size=packet_size;
}then I wanna to create another Class called Class user which I can create a queue for each user (10 users in total) to store type packet information. the queue for each user will be in the order by timestamp.
any idea and sample code will be appreciated.Doesn't sound too hard to me. Your class User (the convention says to capitalize class names) will have an ArrayList or Vector in it to represent the queue, and a method to store a Packet object into the List. An array or ArrayList or Vector will hold the 10 user objects. You will find the right user object from packet.user_id and call the method.
Please try to write some code yourself. You won't learn anything from having someone else write it for you. Look at sample code using ArrayList and Vector, there's plenty out there. Post in the forum again if your code turns out not to behave. -
Please recommend if we have options to read xml file and insert data into table without a temporary table.
DECLARE @data XML;
SET @data =N'<Root>
<List RecordID="946236" />
<List RecordID="946237" />
<List RecordID="946238" />
<List RecordID="946239" />
<List RecordID="946240" />
</Root>'
INSERT INTO t (id) SELECT T.customer.value('@RecordID', 'INT') AS id
FROM @data.nodes('Root/List')
AS T(customer);
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence -
Loading a CSV file and accessing the variables
Hi guys,
I'm new to AS3 and dealt with AS2 before (just getting the grasp when the change it).
Is it possible in AS3 to load an excel .csv file into Flash using the URLLoader (or ???) and the data as variables?
I can get the .csv to load and trace the values (cell1,cell2,cell3....) but I'm not sure how to collect the data and place it into variables.
Can I just create an array and access it like so.... myArray[0], myArray[1]? If so, I'm not sure why it's not working.
I must be on the completely wrong path. Here's what I have so far....
var loader:URLLoader = new URLLoader();
loader.dataFormat = URLLoaderDataFormat.VARIABLES;
loader.addEventListener(Event.COMPLETE, dataLoaded);
var request:URLRequest = new URLRequest("population.csv");
loader.load(request);
function dataLoaded(evt:Event):void {
var myData:Array = new Array(loader.data);
trace(myData[i]);
Thanks for any help,
Skyjust load your csv file and use the flash string methods to allocate those values to an array:
var myDate:Array = loader.data.split(","); -
Loop through a csv file and return the number of rows in it?
What would be simplest way to loop through a csv file and
return the number of rows in it?
<cffile action="read" file="#filename#" output="#csvstr#"
>
<LOOP THROUGH AND COUNT ROWS>ListLen(). Use chr(13) as your delimiter
-
To retrieve the PRT document (a PDF file) and insert the doc in PM order
Hello guys,
I have a challenging task in from printing as follows,
By using TC: IW3D we get print preview of PM Order Set (PM Print Program: YIPRJT01), currently the PRT document number prints in the PM Order. Now we have to insert the PRT documents (a PDF file) into the PM Order set rather than printing the PRT document number ( By using TC: IW33 by going OPERTIONAL TAB we will get the PRT document(a PDF file))
The requirement is to retrieve the PRT document (a PDF file) and insert the document in PM order set with out navigating separately by using the TC: IW33.
If you run the script in the print preview we can able to see PM the order set along with the PRT document (a PDF file).
Thanks & Regards
VishnuI'm also trying to print PRT document with shop papers and still not able to do so. I selected "P" for print on the control key and it should print but still didn't print.
If I understand it right, I think you are trying to do the same.
Have you resolved this issue ?
Thank you,
Sam -
Read Excel file and insert it into a table
Hi All
i'm developing a web app using jdeveloper 11.1.1.3
I want to upload an excel file to a table, is there way in the frame work to do this easily
Txconvert the excel fil to a .csv file and expose the csv file as a datacontrol and then use it in the table
http://technology.amis.nl/blog/2306/uploading-csv-files-into-dynamic-adf-faces-tables-programmtically-creating-columns
Maybe you are looking for
-
Hello, I'm using Lightroom to update my Flickr account but now it is not working. I always get this message: Plug-in error log for plug-in at: C:\Program Files\Adobe\Adobe Photoshop Lightroom 5.6\Flickr.lrplugin **** Error 1 This plug-in's post-proce
-
What is idmManager view attribute to update manager in IDM
We are on IDM6.0 sp1 and using User.waveset.idmManager attribute to update manager of a particular user. <set name='User.waveset.idmManager'> <ref>managerId</ref> </set> However I dont see these changes in IDM when I look the user. Also tried User.ac
-
Where do I find my 'Administrator password'?
I've successfully downloaded Mavericks but have now been asked for 'Administrator password' in order to install it. What is Ap and how do I find it? Thanks.
-
I want to disable tabs. I use a Mac at home, so an application doesn't take the entire screen like on Windows, so tabs are a pointless distraction that constantly gets in the way. Opening a new window is much more convenient. The extension TabKiller
-
Running windows 7 with a blackberry 9300. Receiving error message "Blackberry Desktop software has stopped working" I have tried uninstalling and re-installing to no avail. Any suggestions as to the probable cause and a possible solution?