SQLLDR: Is it possible to import CSV using column defined in CVS?

Hello,
We are in 11gR1 ...and I have just practiced easy SQLLDR import ... So I feel quite new in the domain.
We receive CSV files with, at their first line, the column titles, ...
These CSV have their columns never at the same place ... and we experience difficulties to import their data...
The column titles are the same, but not their position in the file...
Here are small examples :
CSV1 :
Project;Customer;Title *;Description *;Submitted By;Submitted On
Maintenance 1 2 3;CUST_A;Analysis;Description of the Analysis;Bob Dylan;19/08/2008
Maintenance B;CUST_B;Development;Description of the project;Bob Dylan;19/08/2008
CSV2 :
Title *;Description *;Project;Customer;Submitted On;Submitted By
Admin; Description of Administration; Proj1; Cust_A; 25/12/2008; Prince
CSV3 :
Description *;Customer;Title *;Project;Submitted By;Submitted On
Desc profile;Cust_B;Analysis;Projet_A; Phil Collins; 11/03/2009
I hope that their is a solution ...
I suppose that someone got a similar issue ...
Thanks in advance for your help,
Olivier

Hello,
Yes, you are correct ...
like in the examples I provided, the column titles are giving the position of the column data .. but there can have different positions
So, at the moment, I play with the Unix script to decide with CTL I should take ....
So, it looks like, there is no other issue than duplicating the code and the CTL files ...
Any other suggestions or advices ?
Thanks in advance,
Olivier

Similar Messages

  • Import CSV file: column count mismatch by always 1

    Hello,
    I am trying to import data from a CSV file into a HANA db table with an .hdbti file.
    I have a large structure of 332 fields in the table. When I activate the files to start the import, I always get the following message:
    CSV table column count mismatch. The CSV-file: Test.data:data.csv does not match to target table: Test.data::test. The number of columns (333) in csv record 1 is higher than the number of columns (332) in the table.
    But even if I delete the last column in the CSV file, the message stays the same. I also tried adding an additional field in the table on HANA, but then the column numbers in the error message just increase by 1. Then the message is: The number of columns (334) in csv record 1 is higher than the number of columns (333) in the table.
    So, it seems, whatever I do, the system thinks always that the csv file has one column too much.
    With another smaller structure of 5 fields, the import worked that way.
    Do you have an idea what the problem could be?
    Regards,
    Michael

    Hi Michael,
    It may be coz of delimiter problem or something. Can you paste the control file content here. So that i can check it out. Issue may be in your control file.
    Also if you can show the contents of the your *.err error log file, we can have a broader picture.
    Regards,
    Safiyu

  • Importing data- using xml file into HANA Table

    Hi,
    We are using (HDB STUDIO ) - revision 60.......
    Is it possible to import data using XML file into HANA table (Master,Fact tables)?
    (Without using any intermediate adapters for conversion of data.....)
    Can any one suggest us........
    Thank you.

    Hi user450616
    I am a bit confused about what you are trying to achieve.
    Are you:
    1. importing a CSV file into APEX
    2. adding an extra column to the Oracle Table
    3. populating the extra column with the CSV filename?
    Let us know if this is what you are trying to do.
    Cheers,
    Patrick Cimolini

  • How to import csv data into Oracle using c#

    Hello,
    How to import csv data into Oracle using c #. Where data to be imported 3GB in size and number of rows 7512263. I've managed to import csv data into Oracle, but the time it takes about 1 hour. How to speed up the time it takes to import csv data into oracle. Thank you.
    This is my code:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Diagnostics;
    using System.Threading;
    using System.Text.RegularExpressions;
    using System.IO;
    using FileHelpers;
    using System.Data.OracleClient;
    namespace sqlloader
    class Program
    static void Main(string[] args)
    int jum;
    int i;
    bool isFirstLine = false;
    FileHelperEngine engine = new FileHelperEngine(typeof(XL_XDR));
    //Connect To Database
    string constr = "Data Source=(DESCRIPTION=(ADDRESS_LIST="
    + "(ADDRESS=(PROTOCOL=TCP)(HOST= pt-9a84825594af )(PORT=1521 )))"
    + "(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=o11g)));"
    + "User Id=xl;Password=rahasia;";
    OracleConnection con = new OracleConnection(constr);
    con.Open();
    // To Read Use:
    XL_XDR[] res = engine.ReadFile("DataOut.csv") as XL_XDR[];
    jum = CountLinesInFile("DataOut.csv");
    FileInfo f2 = new FileInfo("DataOut.csv");
    long s2 = f2.Length;
    int jmlRecord = jum - 1;
    for (i = 0; i < jum; i++)
    ShowPercentProgress("Processing...", i, jum);
    Thread.Sleep(100);
    if (isFirstLine == false)
    isFirstLine = true;
    else
    string sql = "INSERT INTO XL_XDR (XDR_ID, XDR_TYPE, SESSION_START_TIME, SESSION_END_TIME, SESSION_LAST_UPDATE_TIME, " +
    "SESSION_FLAG, VERSION, CONNECTION_ROW_COUNT, ERROR_CODE, METHOD, HOST_LEN, HOST, URL_LEN, URL, CONNECTION_START_TIME, " +
    "CONNECTION_LAST_UPDATE_TIME, CONNECTION_FLAG, CONNECTION_ID, TOTAL_EVENT_COUNT, TUNNEL_PAIR_ID, RESPONSIVENESS_TYPE, " +
    "CLIENT_PORT, PAYLOAD_TYPE, VIRTUAL_TYPE, VID_CLIENT, VID_SERVER, CLIENT_ADDR, SERVER_ADDR, CLIENT_TUNNEL_ADDR, " +
    "SERVER_TUNNEL_ADDR, ERROR_CODE_2, IPID, C2S_PKTS, C2S_OCTETS, S2C_PKTS, S2C_OCTETS, NUM_SUCC_TRANS, CONNECT_TIME, " +
    "TOTAL_RESP, TIMEOUTS, RETRIES, RAI, TCP_SYNS, TCP_SYN_ACKS, TCP_SYN_RESETS, TCP_SYN_FINS, EVENT_TYPE, FLAGS, TIME_STAMP, " +
    "EVENT_ID, EVENT_CODE) VALUES (" +
    "'" + res.XDR_ID + "', '" + res[i].XDR_TYPE + "', '" + res[i].SESSION_START_TIME + "', '" + res[i].SESSION_END_TIME + "', " +
    "'" + res[i].SESSION_LAST_UPDATE_TIME + "', '" + res[i].SESSION_FLAG + "', '" + res[i].VERSION + "', '" + res[i].CONNECTION_ROW_COUNT + "', " +
    "'" + res[i].ERROR_CODE + "', '" + res[i].METHOD + "', '" + res[i].HOST_LEN + "', '" + res[i].HOST + "', " +
    "'" + res[i].URL_LEN + "', '" + res[i].URL + "', '" + res[i].CONNECTION_START_TIME + "', '" + res[i].CONNECTION_LAST_UPDATE_TIME + "', " +
    "'" + res[i].CONNECTION_FLAG + "', '" + res[i].CONNECTION_ID + "', '" + res[i].TOTAL_EVENT_COUNT + "', '" + res[i].TUNNEL_PAIR_ID + "', " +
    "'" + res[i].RESPONSIVENESS_TYPE + "', '" + res[i].CLIENT_PORT + "', '" + res[i].PAYLOAD_TYPE + "', '" + res[i].VIRTUAL_TYPE + "', " +
    "'" + res[i].VID_CLIENT + "', '" + res[i].VID_SERVER + "', '" + res[i].CLIENT_ADDR + "', '" + res[i].SERVER_ADDR + "', " +
    "'" + res[i].CLIENT_TUNNEL_ADDR + "', '" + res[i].SERVER_TUNNEL_ADDR + "', '" + res[i].ERROR_CODE_2 + "', '" + res[i].IPID + "', " +
    "'" + res[i].C2S_PKTS + "', '" + res[i].C2S_OCTETS + "', '" + res[i].S2C_PKTS + "', '" + res[i].S2C_OCTETS + "', " +
    "'" + res[i].NUM_SUCC_TRANS + "', '" + res[i].CONNECT_TIME + "', '" + res[i].TOTAL_RESP + "', '" + res[i].TIMEOUTS + "', " +
    "'" + res[i].RETRIES + "', '" + res[i].RAI + "', '" + res[i].TCP_SYNS + "', '" + res[i].TCP_SYN_ACKS + "', " +
    "'" + res[i].TCP_SYN_RESETS + "', '" + res[i].TCP_SYN_FINS + "', '" + res[i].EVENT_TYPE + "', '" + res[i].FLAGS + "', " +
    "'" + res[i].TIME_STAMP + "', '" + res[i].EVENT_ID + "', '" + res[i].EVENT_CODE + "')";
    OracleCommand command = new OracleCommand(sql, con);
    command.ExecuteNonQuery();
    Console.WriteLine("Successfully Inserted");
    Console.WriteLine();
    Console.WriteLine("Number of Row Data: " + jmlRecord.ToString());
    Console.WriteLine();
    Console.WriteLine("The size of {0} is {1} bytes.", f2.Name, f2.Length);
    con.Close();
    static void ShowPercentProgress(string message, int currElementIndex, int totalElementCount)
    if (currElementIndex < 0 || currElementIndex >= totalElementCount)
    throw new InvalidOperationException("currElement out of range");
    int percent = (100 * (currElementIndex + 1)) / totalElementCount;
    Console.Write("\r{0}{1}% complete", message, percent);
    if (currElementIndex == totalElementCount - 1)
    Console.WriteLine(Environment.NewLine);
    static int CountLinesInFile(string f)
    int count = 0;
    using (StreamReader r = new StreamReader(f))
    string line;
    while ((line = r.ReadLine()) != null)
    count++;
    return count;
    [DelimitedRecord(",")]
    public class XL_XDR
    public string XDR_ID;
    public string XDR_TYPE;
    public string SESSION_START_TIME;
    public string SESSION_END_TIME;
    public string SESSION_LAST_UPDATE_TIME;
    public string SESSION_FLAG;
    public string VERSION;
    public string CONNECTION_ROW_COUNT;
    public string ERROR_CODE;
    public string METHOD;
    public string HOST_LEN;
    public string HOST;
    public string URL_LEN;
    public string URL;
    public string CONNECTION_START_TIME;
    public string CONNECTION_LAST_UPDATE_TIME;
    public string CONNECTION_FLAG;
    public string CONNECTION_ID;
    public string TOTAL_EVENT_COUNT;
    public string TUNNEL_PAIR_ID;
    public string RESPONSIVENESS_TYPE;
    public string CLIENT_PORT;
    public string PAYLOAD_TYPE;
    public string VIRTUAL_TYPE;
    public string VID_CLIENT;
    public string VID_SERVER;
    public string CLIENT_ADDR;
    public string SERVER_ADDR;
    public string CLIENT_TUNNEL_ADDR;
    public string SERVER_TUNNEL_ADDR;
    public string ERROR_CODE_2;
    public string IPID;
    public string C2S_PKTS;
    public string C2S_OCTETS;
    public string S2C_PKTS;
    public string S2C_OCTETS;
    public string NUM_SUCC_TRANS;
    public string CONNECT_TIME;
    public string TOTAL_RESP;
    public string TIMEOUTS;
    public string RETRIES;
    public string RAI;
    public string TCP_SYNS;
    public string TCP_SYN_ACKS;
    public string TCP_SYN_RESETS;
    public string TCP_SYN_FINS;
    public string EVENT_TYPE;
    public string FLAGS;
    public string TIME_STAMP;
    public string EVENT_ID;
    public string EVENT_CODE;
    I hope someone can give me a solution. Thanks

    The fastest way is to use external tables or sql loader (sqlldr). (If you use external tables or sql loader, you don't use C# at all).

  • Using PowerShell to import CSV data from Vendor database to manipulate Active Directory Users

    Hello,
    I have a big project I am trying to automate.  I am working in a K-12 public education IT Dept. and have been tasked with importing data that has been exported from a vendor database via .csv file into Active Directory to manage student accounts. 
    My client wants to use this data to make bulk changes  to student user accounts in AD such as moving accounts from one OU to another, modifying account attributes based on State ID, lunchroom ID, School, Grade, etc. and adding new accounts / disabling
    accounts for students no longer enrolled.
    The .csv that is exported doesn't have headers that match up with what is needed for importing in AD, so those have to be modified in this process, or set as variables to get the correct info into the correct attributes in AD or else this whole project is
    a bust.  He is tired of manually manipulating the .csv data and trying to get it onto AD with few or no errors, hence the reason it has been passed off to me.
    Since this information changes practically daily, I need a way to automate user management by accomplishing the following on a scheduled basis.
    Process must:
    Check to see if Student Number already exists
    If yes, then modify account
    Update {School Name}, {Site Code}, {School Number}, {Grade Level} (Variables)
    Add correct group memberships (School / Grade Specific)
    Move account to correct OU (OU={Grade},OU=Students,OU=Users,OU={SiteCode},DC=Domain,DC=net)
    Remove incorrect group memberships (School / Grade Specific)
    Set account status (enabled / disabled)
    If no, create account
    Import Student #
    Import CNP #
    Import Student name
    Extract First and Middle initial
    If duplicate name exists
    Create log entry for review
    Import School, School Number, Grade Level
    Add to correct Group memberships (School / Grade Specific)
    Set correct OU (OU={Grade},OU=Students,OU=Users,OU={SiteCode},DC=Domain,DC=net)
    Set account Status
    I am not familiar with Powershell, but have researched enough to know that it will be the best option for this project.  I have seen some partial solutions in VB, but I am more of an infrastructure person instead of scripting / software development. 
    I have just started creating a script and already have hit a snag.  Maybe one of you could help.
    #Connect to Active Directory
    Import-Module ActiveDirectory
    # Import iNOW user information
    $Users = import-csv C:\ADUpdate\INOW_export.csv
    #Check to see if the account already exists in AD
    ForEach ( $user in $users )
    #Assign the content to variables
    $Attr_employeeID = $users."Student Number"
    $Attr_givenName = $users."First Name"
    $Attr_middleName = $users."Middle Name"
    $Attr_sn = $users."Last Name"
    $Attr_postaldeliveryOfficeName = $users.School
    $Attr_company = $users."School Number"
    $Attr_department = $users."Grade Level"
    $Attr_cn = $Attr_givenName.Substring(0,1) + $Attr_middleName.Substring(0,1) + $Attr_sn
    IF (Get-ADUser $Attr_cn)
    {Write-Host $Attr_cn already exists in Active Directory

    Thank you for helping me with that before it became an issue later on, however, even when modified to be $Attr_sAMAaccountName i still get errors.
    #Connect to Active Directory
    Import-Module ActiveDirectory
    # Import iNOW user information
    $Users = import-csv D:\ADUpdate\Data\INOW_export.csv
    #Check to see if the account already exists in AD
    ForEach ( $user in $users )
    #Assign the content to variables
    $Attr_employeeID = $users."Student Number"
    $Attr_givenName = $users."First Name"
    $Attr_middleName = $users."Middle Name"
    $Attr_sn = $users."Last Name"
    $Attr_postaldeliveryOfficeName = $users.School
    $Attr_company = $users."School Number"
    $Attr_department = $users."Grade Level"
    $Attr_sAMAccountName = $Attr_givenName.Substring(0,1) + $Attr_middleName.Substring(0,1) + $Attr_sn
    IF (Get-ADUser $Attr_sAMAccountName)
    {Write-Host $Attr_sAMAccountName already exists in Active Directory
    PS C:\Windows\system32> D:\ADUpdate\Scripts\INOW-AD.ps1
    Get-ADUser : Cannot convert 'System.Object[]' to the type 'Microsoft.ActiveDirectory.Management.ADUser'
    required by parameter 'Identity'. Specified method is not supported.
    At D:\ADUpdate\Scripts\INOW-AD.ps1:28 char:28
    + IF (Get-ADUser $Attr_sAMAccountName)
    + ~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidArgument: (:) [Get-ADUser], ParameterBindingException
    + FullyQualifiedErrorId : CannotConvertArgument,Microsoft.ActiveDirectory.Management.Commands.GetAD
    User

  • Is it possible to import music into iPad without using iTunes?

    Do any of of you know whether or not it is possible to import music into iPad, like when you can import pictures, without the use of iTunes ( I don't have a computer)? I have music on my phone and on USB flash drives. Thnx

    If you are in America then you can download your past iTunes music purchases via the store (http://support.apple.com/kb/HT2519). But no, you can't import from flash drives (the camera connection kit can only import photos and videos) or from an iPhone.

  • Import TermSet CSV using client side object model

    Hello,
    I want to import CSV in TermStore using client side object model. Unfortunately there is no ImportManager here.
    Is there any other way (Other than reading from CSV and adding term one by one to term store)?
    Regards, Nanddeep Nachan

    Hi,
    Here is a tool(server-side) from codeplex for your reference:
    SharePoint 2010 CSV Bulk Taxonomy TermSet Importer/Exporter
    If you want to import termsets  from CSV in Client-Side, we can refer the tool above.
    You can develop a windows form application and use .Net Client Object Model to achieve it. The following articles is about how to operate the termset using Client Object Model for you reference:
    http://sundarnarasiman.net/?p=87 (Download)
    http://code.msdn.microsoft.com/office/SharePoint-2013-Synchronize-d40638d1/sourcecode?fileId=72317&pathId=166025385
    http://www.c-sharpcorner.com/Blogs/10853/how-to-create-a-term-set-for-the-specified-group-using-clien.aspx
    Thanks,
    Dennis Guo
    TechNet Community Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Dennis Guo
    TechNet Community Support

  • Where to import CSV file using HANA STUDIO version 1.0.26

    Hi Experts,
    In this version HANA studio, i have no idea how to import CSV file ,as it looks different from the HANA academy vedio . hope someone could provide me the method.Tks!
    About Screenshot

    Hi Krishna Tangudu ,
    How to use the IMPORT command as you mentioned?

  • Is it possible to import my playlist from a different computer to anouther with out the use of a flashdrive?

    Is it possible to import a music library from one computer to anouter with out a flash drive or eny other forms of music storage?

    Connect both to the same network, transfer entire library from source machine to target by way of a shared folder.
    tt2

  • Is it possible to import, only changes since last import using imp/impdp

    on our production environment, we export three times a day.(10.00AM,1.00PM,6:30PM)
    and We only want to import the evening export - we have to kind of make sure that if the online system fails _ we have a data up to yesterday evening.
    i.e. we want a sort of incremental import, for example we would have yesterday's evening import and today we only want to import all the changes since yesterday's evenings import - that means we want to import into existing database but we want to import only the changes since last import.
    it would be great to hear from you
    the database is 10g R1
    thank you

    Thank you all, for your prompt response
    I know about RMAN, but our management outsourced our data center and the guys there does not look comfortable around oracle - and me as a DBA was assigned to taking this export backup and import it to another PC once in a day
    so I was thinking if it was possible to import "incrementally"
    it is good to know that it is not possible, because I don't have to spend time looking for a solution which is not there.
    Thanks all

  • CLM Importing Master Agreement: Is it possible to import custom collection

    Hello,
    We are looking to migrate some legacy data into CLM using the import master agreement (setup->Import and Export Tools).  This approach works fine for all standard data as well as extensions that are single entry fields (not collections).  We would like to load some data into extension field that are collections and are wondering what is the best, most efficient way to accomplish this.
    I can only think of the following method:
    Import all master agreement data standard fields and extension fields (not collections).  Once all are entered, we go into the master agreement and add the collection data manually or by importing csv files at that time.
    This method will be time consuming.  Is there a better way to accomplish this?
    Thanks in advance,
    Kyle

    Hi Kyle & Venkat,
    I am trying to import the contract through 'contract import workbook' present in RG.
    I have made & verified changes in field data values of the three worksheets in contracts.
    Now when i try importing, it gets failed giving me the error  - An error was encountered in column CONTACT/LOCATION.
    However, the same values do exist in Master Data.
    Can you please let me know if the same error occured with you folks & possible troubleshooting.
    Any pointers would be highly appreciated.
    Thanks,
    Tripti

  • Import CSV file Skype for Mac

    Cannot seem to import contacts.  It is well hidden if it is possible, if not, it is a ridiculous omission.
    Dear Skype;
    Please add the feature of importing contacts from a CSV file, or better yet from a google account.

    There is no way to import contacts directly into Skype for Mac from a CSV file. However, you can import contacts (with email and phone information) into Contacts.app. These system contacts can then be viewed in Skype using the Mac Contacts feature. See Preferences > General > Show Mac Contacts.
    Part of the reason that it's not currently possible to import contacts in this way is because of the hadshake required: you must send a contact request to each contact you wish to add to your list. This includes a message explaining who you are, and why they should add you. Most people won't be able to receive a call or IM from you until they've accepted your contact request.
    One last thing: your contact list is stored in the cloud. So when you log into Skype for Mac, you'll see your list of contacts just as it was on your Android device (for example).

  • Import-CSV | New-ADGroup not working as expected with Powershell

    I've looked all over and I can't seem to find an explanation for why this command works perfectly with New-ADUser but not with New-ADGroup.
    These are commands I'm using:
    For Users:
    Import-CSV C:\Imports\adusers.csv | New-ADUser
    This works great. All 500+ users imported with all fields.
    For Groups:
    Import-CSV C:\Imports\adgroups.csv | New-ADGroup
    Only the first line is run correctly. Then I get this error: The specified group already exists
    Here is a snip of my CSV for Groups:
    Name,DisplayName,Description,GroupCategory,GroupScope,Path
    DB Users,DB Users,Group for DB users,Global,"OU=Security Groups,OU=ABC Users,DC=domain,DC=local"
    Accounting,Accounting,Access to the Accounting folder,Security,Global,"OU=Security Groups,OU=ABC Users,DC=domain,DC=local"
    Am I missing something here or is this not possible?
    THanks.

    I knew I would figure this out as soon as I posted it...
    This is the behavior you see if the SamAccountName field is not included.

  • Import-csv file for robocopy

    I am using a powershell script which imports a csv file to copy directories.
    Since the folders which I need to copy contain spaces I use double quotes in the csv file.
    Although I don't get the right syntax when I use import-csv
    Either there are too many quotes in the source and/or destination folder or too few quotes.
    the robocopy command should work fine if there are quotes at the beginning and the end of each folder.
    So I started with the following syntax in my csv file:
    source;destination
    "source folder";"destination folder"
    If I run the import-csv command with the content listed above it only shows double quotes at the destination folder.
    so I started adding additonal double quotes around the source folder, it seems toe be an easy thing, but I didn't find the correct amount of double quotes to get the source and destination folder both starting and ending with double quotes.
    any suggestion how to fix this ?

    I agree with jrv, do some reading to get a basic understanding of the concepts
    The script I posted was just an example of how to enclose the data in quotes, since the quotes are removed when importing a csv, they are only there for the purpose of the data containing a comma (,). So now we need to put them back since, your paths contains
    spaces and breaks your robocopy.
    Import-Csv F:\Testing\test.csv -Delimiter ";" | Foreach {
    """$($_.Source)""" + " " + """$($_.destination)"""
    After I import the csv file, I send it over to the Foreach-Object cmdlet, this takes pipeline data and processes it. the $_ is the current object on the pipe line, hence me doing $_.Source
    With your script, you are doing
    $CsvFile = ".\test.csv"
    $srchome = "c:\source location"
    $dsthome = "c:\destination location"
    $Logfile = ".\copy.log"
    $csv = Import-CSV $CsvFile -Delimiter ';'
    foreach ($folder in $csv)
    $srcdoc = $srchome +$folder.source
    $dstdoc = $dsthome +$folder.destination
    robocopy $srcdoc $dstdoc /z /e /np /MIR /COPY:DAT /r:10 /w:30 /log+:$LogFile
    You are saving the results from Import-Csv to a variable $csv, then looping through the variable. So if you possible did the following it would work as my script showed
    $srcdoc = """$($srchome$folder.source)"""
    $dstdoc = """$($dsthome$folder.destination)"""
    Now by looking at your script I am assuming that all the source and destination paths in your csv are \somepath\somepath\.... since the srchome and dsthome do not have a ending \??
    You can clean up the script to be
    $csvFile = ".\test.csv"
    $srchome = "c:\source location"
    $dsthome = "c:\destination location"
    $logfile = ".\copy.log"
    Import-Csv $csvFile -Delimiter ";" | ForEach-Object {
    $srcDoc = """$($srcHome$_.Source)"""
    $dstDoc = """$($dstHome$_.Destination)"""
    RoboCopy $srcDoc $dstDoc /z /e /np /MIR /COPY:DAT /r:10 /w:40 /log+:$logFile
    If you find that my post has answered your question, please mark it as the answer. If you find my post to be helpful in anyway, please click vote as helpful.
    Don't Retire Technet

  • How do I import csv file into a SharePoint list?

    I am trying to use a PowerShell script to load data into a SharePoint list from a csv file. When I run my code, it seems to go through the process of loading the data into the list. However when I go to my list, all I see is "System.Object[]" displayed
    in the first column of all my rows with no other data displayed. When I check my csv file, I see a ton of data (several rows and columns) but that is not being moved to my SharePoint list. This is what my script looks like
    if((Get-PSSnapin | Where {$_.Name -eq “Microsoft.SharePoint.PowerShell”}) -eq $null) {
    Add-PSSnapin Microsoft.SharePoint.PowerShell
    $web = Get-SPWeb http://link to web
    $list = $web.lists["List Name"]
    $recordsNumber = 0
    foreach($i in Import-CSV myCSVFile.csv)
    $new = $list.Items.Add()
    $new["Title"] = $i.Title,
    $new["FirstName"] = $i.FirstName,
    $new["LastName"] = $i.LastName
    $new.Update()
    $recordsNumber++
    "Added " + $recordsNumber.ToString() + " records."
    "Done. Press any key to continue..."
    $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
    Any ideas on how to fix this, and get my list populated with data?

    if ( (Get-PSSnapin -Name Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue) -eq $null )
    Add-PsSnapin Microsoft.SharePoint.PowerShell
    $host.Runspace.ThreadOptions = "ReuseThread"
    #Open SharePoint List
    $SPServer=http://SOMESERVER
    $SPAppList="/Lists/List Name/"
    $spWeb = Get-SPWeb $SPServer
    $spData = $spWeb.GetList($SPAppList)
    $InvFile="myCSVFile.csv"
    # Get Data from Inventory CSV File
    $FileExists = (Test-Path $InvFile -PathType Leaf)
    if ($FileExists) {
    "Loading $InvFile for processing..."
    $tblData = Import-CSV $InvFile
    } else {
    "$InvFile not found - stopping import!"
    exit
    # Loop through Applications add each one to SharePoint
    "Uploading data to SharePoint...."
    foreach ($row in $tblData)
    "Adding entry for "+$row."Application Name".ToString()
    $spItem = $spData.AddItem()
    $spItem["Title"] = $row."Title".ToString()
    $spItem["FirstName"] = $row."FirstName".ToString()
    $spItem["LastName"] = $row."LastName".ToString()
    $spItem.Update()
    "Upload Complete"
    $spWeb.Dispose()
    Link
    Please 'propose as answer' if it helped you, also 'vote helpful' if you like this reply.

Maybe you are looking for

  • Error while running the financial report in the workspace.

    Hi, Im getting the below error while running the financial report in the workspace in HTML mode. *"Required application module reporting.HRRunDlg is not configured. Please contact your administrator".* And im not able to login to the Hyperion Financi

  • Search data into ResultSets to genrate a complex report

    Hi, I am writing a report called "Product Flow". The report headings are follows prodcode prod name opening qty purchase_qty sales_qty closing_qty ============================================================= To achieve this, I need to know the produ

  • XML Transformation - Migration from JDK 1.4 to JDK 1.6

    Hi all, I am switching from JDK 1.4 to JDK 1.6 but my XSLT transformations are outputting different XML (although structurally sound). JDK 1.6 outputs the namespaces for each element rather than placing them at the top level node. I've included the s

  • 3.0.9.8.3 patch availability

    when will 3.0.9.8.3 patch will be available ? this month ? thanks

  • ITunes mousewheel bug - Can't scroll in Prefs iPod Music

    The scroll ball functionality of the Apple Mighty Mouse doesn't seem to work on the list of playlists in iTunes>Preferences...>iPod>Music>Automatically update selected playlists only. Can anyone else confirm this? If this is a reproducible issue, how