Importing CSV file and parsing it

First of all I am very new to writing powershell code.  Therefore, my question could be very rudimentary, but I cannot find an answer, so please help.
I'm trying to read a CSV file and parse it.  I cannot figure out how to access nth element without hardcoding its name.
$data = Import-Csv $file   #import CSV file
# read column headers (manually read the first row of the data file, or import it from other source, or ...)
$file_dump = Get-Content $file  #OK, I'm sure there is another way to get just the first line, but that's not relevant
$name_list = $file_dump[0].split(",")
# access element
$temp = $data[$i].Name  # works - but that's HARDCODING the column name into the script - what if someone changes it?
#but what I want to do is
$temp = $data[$i].$name_list[0]
How do I do this in PowerShell?

So you're asking how to get the first data point from the first column, no matter what the header is?
Why won't you know what your input file looks like?
You can always drop the first line of the file to remove the existing headers and then use the -Header parameter of Import-Csv to give yourself known headers to reference (this will only work if you know how many columns to expect, etc etc etc).
http://ss64.com/ps/import-csv.html
Don't retire TechNet! -
(Don't give up yet - 13,085+ strong and growing)

Similar Messages

  • Read CSV File and parse it

    Hi.
    I have a .csv file on my filesystem.
    Could you post few code to read it from filesystem and parse every rows in it?
    Thanks a lot.

    External tables are far easier to use... e.g.
    I have a file on my server in a folder c:\mydata called test.txt which is a comma seperated file...
    1,"Fred",200
    2,"Bob",300
    3,"Jim",50As sys user:
    CREATE OR REPLACE DIRECTORY TEST_DIR AS "c:\mydata";
    GRANT READ, WRITE ON DIRECTORY TEST_DIR TO myuser;Note: creates a directory object, pointing to a directory on the server and must exist on the server (it doesn't create the physical directory).
    As myuser:
    SQL> CREATE TABLE ext_test
      2    (id      NUMBER,
      3     empname VARCHAR2(20),
      4     rate    NUMBER)
      5  ORGANIZATION EXTERNAL
      6    (TYPE ORACLE_LOADER
      7     DEFAULT DIRECTORY TEST_DIR
      8     ACCESS PARAMETERS
      9       (RECORDS DELIMITED BY NEWLINE
    10        FIELDS TERMINATED BY ","
    11        OPTIONALLY ENCLOSED BY '"'
    12        (id,
    13         empname,
    14         rate
    15        )
    16       )
    17     LOCATION ('test.txt')
    18    );
    Table created.
    SQL> select * from ext_test;
            ID EMPNAME                    RATE
             1 Fred                        200
             2 Bob                         300
             3 Jim                          50
    SQL>
    {code}
    http://www.morganslibrary.org/reference/externaltab.html                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Importing CSV file and converting to an Array

    Hi all,
    I'm working on a site that is importing a published CSV (comma seperated values) via actionscript 3.0 URLloader().  Right now I'm just trying to get actionscript to successfully input the imported data from the CSV into an Array, so the CSV file has only 1 cell which contains "athleticMaroon,charcoal,colonialBlue,kellyGreen,fullColor".
    Here's the code I'm using:
    //create new array
    var shirtLiveIntense_btn_Colors:Array=new Array();
    //run CSV data import
    URLLoaderCSV();
    shirtLiveIntense_btn.addEventListener(MouseEvent.CLICK, selectingLogo);
    function selectingLogo(e:MouseEvent):void{
              trace ("logo selected");
              var colorButtons:Array=this[e.currentTarget.name+"_Colors"];
              for (var i:uint=0; i<colorButtons.length; i++) {
                        colorButtons[i].ivar=i;
                        colorButtons[i].addEventListener(MouseEvent.CLICK, shirtColorOption);
    //CSV data import function
    function URLLoaderCSV() {
                var loader:URLLoader = new URLLoader();
                configureListeners(loader);
                var request:URLRequest = new URLRequest("https://docs.google.com/spreadsheet/pub?hl=en_US&hl=en_US&key=0AlJnOKOffTSxdFk0RVlEUTVHeF9 DMHZfZ0JzSkJjZFE&single=true&gid=1&output=csv");
                try {
                    loader.load(request);
                } catch (error:Error) {
                    trace("Unable to load requested document.");
    function configureListeners(dispatcher:IEventDispatcher):void {
                dispatcher.addEventListener(Event.COMPLETE, completeHandler);
                dispatcher.addEventListener(Event.OPEN, openHandler);
                dispatcher.addEventListener(ProgressEvent.PROGRESS, progressHandler);
                dispatcher.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
                dispatcher.addEventListener(HTTPStatusEvent.HTTP_STATUS, httpStatusHandler);
                dispatcher.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
    function completeHandler(event:Event):void {
                var loader:URLLoader = URLLoader(event.target);
                trace("completeHandler: " + loader.data);
                                  shirtLiveIntense_btn_Colors.push(loader.data);
    function openHandler(event:Event):void {
                trace("openHandler: " + event);
    function progressHandler(event:ProgressEvent):void {
                trace("progressHandler loaded:" + event.bytesLoaded + " total: " + event.bytesTotal);
    function securityErrorHandler(event:SecurityErrorEvent):void {
                trace("securityErrorHandler: " + event);
    function httpStatusHandler(event:HTTPStatusEvent):void {
                trace("httpStatusHandler: " + event);
    function ioErrorHandler(event:IOErrorEvent):void {
                trace("ioErrorHandler: " + event);
    Here is the output:
    openHandler: [Event type="open" bubbles=false cancelable=false eventPhase=2]
    progressHandler loaded:57 total: 0
    httpStatusHandler: [HTTPStatusEvent type="httpStatus" bubbles=false cancelable=false eventPhase=2 status=200]
    completeHandler: athleticMaroon,charcoal,colonialBlue,kellyGreen,fullColor
    logo selected
    ReferenceError: Error #1056: Cannot create property ivar on String.
              at main_fla::MainTimeline/selectingLogo()
    Examining the output results, I see it is clearly loading the data from the CSV file correctly, but what I think it's doing is importing the data as one string, aka "athleticMaroon,charcoal,colonialBlue,kellyGreen,fullColor", and pushing it to shirtLiveIntense_btn_Colors:Array=new Array().  But, as I see from the error, function selectingLogo(e:MouseEvent) can't process the array because it contains a string.
    If I switch out shirtLiveIntense_btn_Colors.push(loader.data); with shirtLiveIntense_btn_Colors.push(athleticMaroon,charcoal,colonialBlue,kellyGreen,fullColor);, everything works like a charm, but I need the array to be assigned from the dynamic data in the CSV file.
    Can anyone lend a hand in getting the imported stringed CSV data pushed to an accessable array?
    Thanks!

    Thanks kglad for the reply.
    I substituted shirtLiveIntense_btn_Colors.push(loader.data); for shirtLiveIntense_btn_Colors=loader.data.split(","); like you suggested, but I still got the same output:
    openHandler: [Event type="open" bubbles=false cancelable=false eventPhase=2]
    progressHandler loaded:57 total: 0
    httpStatusHandler: [HTTPStatusEvent type="httpStatus" bubbles=false cancelable=false eventPhase=2 status=200]
    completeHandler: athleticMaroon,charcoal,colonialBlue,kellyGreen,fullColor
    athleticMaroon,charcoal,colonialBlue,kellyGreen,fullColor
    logo selected
    ReferenceError: Error #1056: Cannot create property ivar on String.
              at main_fla::MainTimeline/selectingLogo()
    I also tried shirtLiveIntense_btn_Colors.push(loader.data.split(",")); and it gave me the following output instead:
    openHandler: [Event type="open" bubbles=false cancelable=false eventPhase=2]
    progressHandler loaded:57 total: 0
    httpStatusHandler: [HTTPStatusEvent type="httpStatus" bubbles=false cancelable=false eventPhase=2 status=200]
    completeHandler: athleticMaroon,charcoal,colonialBlue,kellyGreen,fullColor
    athleticMaroon,charcoal,colonialBlue,kellyGreen,fullColor
    logo selected
    TypeError: Error #1006: addEventListener is not a function.
              at main_fla::MainTimeline/selectingLogo()
    Any ideas?
    Thanks for the help!

  • How to import a csv file and read  in sap ui5?

    Hi,
    I want to import a file and read it contents to bind it to table.How to do it?
    Thanks in advance.

    I tried to do this all from within the application but found it easier to just start with a JSON file. But, you can use a JS library to convert your CSV into JSON from within the application like this one:
    archan937/csonv.js · GitHub
    I just converted my CSV to JSON. Once you have that, all you need to do is instantiate a model for it and bind to table.
      onInit: function () {
        var oModel = new sap.ui.model.json.JSONModel("PATH TO YOUR JSON FILE");
        this.getView().setModel(oModel);
      <Table id="idProductsTable"
        inset="false"
        items="{
          path: '/ProductCollection',
          sorter: {
            path: 'Name'
        }">
    The UI5 demo kit is a good resource. I believe it'll be same/similar for SAPUI5:
    OpenUI5 SDK - Demo Kit
    See here for example of defining your model and binding to a table:
    sap.m Explored

  • Import group members those are inactive more than 30 days to a csv file and then send the updated list by email

    Hello,
    I am very new to powershell and I have been looking for a solution where I can list all the inactive members more than 30 days from  particular groups in AD, export the updated list to a csv file and send the file by email . . Can someone help me on
    this?
    thanks

    Hi,
    Take a look at Get-ADGroupMember, Get-ADUser, Export-Csv, and Send-MailMessage:
    http://ss64.com/ps/get-adgroupmember.html
    http://ss64.com/ps/get-aduser.html
    http://ss64.com/ps/export-csv.html
    http://ss64.com/ps/send-mailmessage.html
    Let us know if you have any specific questions.
    Don't retire TechNet! -
    (Don't give up yet - 13,085+ strong and growing)

  • Powershell script to update a field value (recursively) in sharepoint form a .CSV file and not changing the updated by value

    need to run through a list of old to new data (.csv) file and change them in a sharepoint list - can not make it work
    here is my base attempt.
    $web = Get-SPWeb site url
    $list = $web.lists["List Name"]
    $item = $list.items.getitembyid(select from the items.csv old)
    $modifiedBy = $item["Editor"]
    #Editor is the internal name of the Modified By column
    $item["old"] = "new from the .csv file parsed by power sehll
    $ite.Syste,Update($false);
    $web.Dispose()

    Hi,
    According to your description, my understanding is that  you want to update SharePoint field value from a CSV file recursively.
    We can import CSV file using the Import-CSV –path command, then update the field value in the foreach loop.
    Here is a code snippet for your reference:
    Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
    $csvVariable= Import-CSV -path "http://sp2010.contoso.com/finance/"
    # Destination site collection
    $WebURL = "http://sp2010.contoso.com/sites/Utility/"
    # Destination list name
    $listName = "Inventory"
    #Get the SPWeb object and save it to a variable
    $web = Get-SPWeb -identity $WebURL
    #Get the SPList object to retrieve the list
    $list = $web.Lists[$listName]
    #Get all items in this list and save them to a variable
    $items = $list.items
    #loop through csv file
    foreach($row in $csvVariable)
    #loop through SharePoint list
    foreach($item in $items)
    $item["ID #"]=$row."ID #"
    $item.Update()
    $web.Dispose()
    Here are some detailed articles for your reference:
    http://blogs.technet.com/b/stuffstevesays/archive/2013/06/07/populating-a-sharepoint-list-using-powershell.aspx
    http://social.technet.microsoft.com/wiki/contents/articles/25125.sharepoint-2013-powershell-to-copy-or-update-list-items-across-sharepoint-sites-and-farms.aspx
    Thanks
    Best Regards
    Jerry Guo
    TechNet Community Support

  • Read a CSV file and dynamically generate the insert

    I have a requirement where there are multiple csv's which needs to be exported to a sql table. So far, I am able to read the csv file and generate the insert statement dynamically for selected columns however, the insert statement when passed as a parameter
    to the $cmd.CommandText
    does not evaluate the values
    How to evaluate the string in powershell
    Import-Csv -Path $FileName.FullName | % {
    # Insert statement.
    $insert = "INSERT INTO $Tablename ($ReqColumns) Values ('"
    $valCols='';
    $DataCols='';
    $lists = $ReqColumns.split(",");
    foreach($l in $lists)
    $valCols= $valCols + '$($_.'+$l+')'','''
    #Generate the values statement
    $DataCols=($DataCols+$valCols+')').replace(",')","");
    $insertStr =@("INSERT INTO $Tablename ($ReqColumns) Values ('$($DataCols))")
    #The above statement generate the following insert statement
    #INSERT INTO TMP_APPLE_EXPORT (PRODUCT_ID,QTY_SOLD,QTY_AVAILABLE) Values (' $($_.PRODUCT_ID)','$($_.QTY_SOLD)','$($_.QTY_AVAILABLE)' )
    $cmd.CommandText = $insertStr #does not evaluate the values
    #If the same statement is passed as below then it execute successfully
    #$cmd.CommandText = "INSERT INTO TMP_APL_EXPORT (PRODUCT_ID,QTY_SOLD,QTY_AVAILABLE) Values (' $($_.PRODUCT_ID)','$($_.QTY_SOLD)','$($_.QTY_AVAILABLE)' )"
    #Execute Query
    $cmd.ExecuteNonQuery() | Out-Null
    jyeragi

    Hi Jyeragi,
    To convert the data to the SQL table format, please try this function out-sql:
    out-sql Powershell function - export pipeline contents to a new SQL Server table
    If I have any misunderstanding, please let me know.
    If you have any feedback on our support, please click here.
    Best Regards,
    Anna
    TechNet Community Support

  • Is there a way to select a certain box of elements from a csv file and read that into LabVIEW?

    Hello all, I was wondering if there was a way to select only a certain "box" of elements from a .csv file in LabVIEW? I have LabVIEW 2011 and my main goal is to take two arrays and graph them against each other. I can import the .csv file just fine and separate each row and each column to be its own, but say I have an 8X8 but want to graph the middle 4X5 or something like that. Is there any way to extract an array without starting at the beginning and without ending at the end? Thank you in advance.
    Solved!
    Go to Solution.

    Hi Szklanam,
    as a CSV file is just a TXT file with a different suffix you can read a certain number of lines of that file. So you can limit the number of rows in your resultung array. To limit the number of columns you still have to use ArraySubset, so maybe it's a lot easier to read the full CSV file and pick the interesting spots with ArraySubset...
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • How to configure sync rules involving a CSV file and portal self service

    Hello,
     I need to configure some FIM sync rules for the following scenario:
     User account details are entered from a HR CSV file and exported to AD  Users have the ability to modify their own AD attributes in the
    FIM portal (there is not a requirement for them to view their  HR CSV data in the portal). The FIM portal modifications will be exported to AD as expected.  
    My setup is as follows:
    CSV file - name, last name, employee ID, address.
    CSV MA - has direct attribute flows configured in the MA between the data source and MV Portal self service attributes –      
    users can edit mobile, display name and photo
    I've also set the CSV MA as precedent for the attributes
    FIM MA – attribute flows defined for MV to Data Source as usual (i.e. firstname to firstname, accountname to accountname, etc).
    AD MA – no attribute flows defined as inbound and outbound sync rules have been configured in the portal using the Set\MPR\Triple.
    I’m thinking of using the following run profiles:
    CSV MA – full import and delta sync (imports HR data)
    FIM MA –  export and delta import (imports portal changes)
    FIM MA – delta sync (syncs any portal changes)
    AD MA – export and delta import
    If my understanding is correct this should sync HR data from CSV to AD, as well as user attribute self service updates from the portal to AD.
    If I wanted to just do a HR CSV sync could I get away with just steps 1 & 4 ? (presumably not as my rules are in the FIM portal?)
    If I wanted to do just a portal sync, could I get away steps 2-4?
    Any advice on how to improve my setup is much appreciated - cheers
    IT Support/Everything

    The truth is that your design should be done in the way that it doesn't matter which profiles in which order you will execute. At the end, if you will run all import, synch and export profiles on each data source you should get same result. This is beauty
    of synch engine here.
    Your steps from 1-4 will synch data to your data sources and at the end will give you expected result. But not because of the order you are executing them but because of correct attribute flows. If flows from CSV file and from FIM portal might be done for
    the same attributes you need to think also about attribute precedence.   
    Tomek Onyszko, memberOf Predica FIM Team (http://www.predica.pl), IdAM knowledge provider @ http://blog.predica.pl

  • Looking for a Notes app that I can import CSV files into?

    As the title says, I'm looking for a good notes application for my iPhone that I can import CSV files into. I have tried both Appigo and Notespark, but I can't easily scroll through them, as I have 2,000+ notes. Is there any app that I can import my notes into and also scroll through quickly? I'd like something that works similarly to how you scroll through songs on the iPhone/iTouch, with the column on the right where you can skip to songs (notes, in this case) that start with a certain letter.
    Thanks!

    Hi Tx Tar Heel,
    I've been using Office2HD: https://itunes.apple.com/us/app/office2-hd/id364361728?mt=8
    Its cheaper than Numbers and it also works for Word and PowerPoint files too. I like the Dropbox integration. I can start on my Office docs (Word, Excel, PowerPoint) in the office and then edit those files with Office2HD when I'm out of the office. Files saves right back to Dropbox so that when I get back to the office the files are already updated. Not bad for a $7.99 app!
    Hope this helps!
    ~Joe

  • How to import csv-file in Numbers 3.2.2.

    I start using Numbers in stead of Excel. I would like to import csv-files from my bank, but when I open the csv-file in Numbers, everything is imported in the same cell. I composed a testfile: 01/08/2014,”text”,”more text”,”even more text” in Pages, exported to a textfile and changed the extension from .txt in .csv. It did not help, everything was in the same cell. What must be changed to become successful in importing csv-files? I am using Numbers 3.2.2. and an iMac with 2,8 GHz Intel Core i7 processor and 8 GB 1067 MHz DDR3 memory with OS X 10.9.4.
    Thanks, Joan Voormolen

    You can do this using Pages. Without using outside scripts or functions. The Pages Find/Replace function will let you change the delimiter on the data in your file.
    Open the file in Pages. Click Show Invisibles. (this will show you the delimiter used in the file)
    If you see a * as the delimiter, that is a space. Some data files are space delimited. This is a really poor way to delimit numerical data files.
    If you see a fat arrow to the right, the file is Tab delimited
    Obviously, a comma is not a hidden character. Some files are comma delimited
    Whatever else might have been used as a delimiter (for example a semi colon is sometimes used) will be apparent.
    The delimiter should be something that is not used anywhere else in the "data"... text, numbers, etc., you want to delimit. Numbers considers a comma as a valid delimiter for files with the suffix .csv . It considers a tab as a valid delimiter with files with the suffix .txt . It does not consider spaces a valid delimiter in with any file suffix. But some programs use odd delimiters (semi colon, colon, double spaces, etc) as delimiters.
    Use the Find command, then Find/Replace as you need to create that delimiter numbers recognizes. Let's say a semi colon was used as a delimiter. Enter the current delimiter (semi colon)  into the Find box. Pages should highlight all the instances of your entry. Enter a comma (to create comma delimited data file) in the Replace box. You should now see a comma as the delimiter.
    Important Don't forget, any other comma used in the file will also be considered a delimiter. (a comma in 1,000 for example). So check the data. If you see a comma used another way you will want to eliminate that BEFORE you do the "comma as delimiter" replacement. If you have 1,000, do a find/replace with comma as the find, nothing as the replace, first. THEN do the replacement of the semi colon.
    Now comes the "tricky" part from what I could see. You want to save this new file with a suffix of .csv. (Export the file) Numbers will only open a comma delimited file with separated data (by comma) if it's suffix is .csv. Pages only gives you limited export options and puts the file suffix on for you automatically. CSV is not one of the options!
    Choose Text. Pages will name the file .txt. Quit Pages. Go to the file on your desktop (or wherever you saved it). Change the file suffiix from .txt to .csv.
    That's it. Open the file with Numbers. Numbers will create a separate column for everything between the comma's.
    You can use this same method to alter your data file before you import it into Numbers. For example, one file I wanted to import had time=xxx . I only wanted the actual time, not the text attached to it, in my spreadsheet. I did a find/replace with "time=" as the find. A comma as the replace. Even though "time=xxx" is one "word", Pages identified the "time=" within the word to allow the replacement.
    Numbers does not provide a "choose delimiter" function when opening a file. Instead it automatically uses the standard delimiter based on the file suffix. CSV means Comma, so if the file is named .csv it will only look for and use a comma as the delimiter to put the data into separate columns. I believe .txt uses only a tab as the delimiter. In the above example you could find/replace to a Tab. Then Export to Text. And numbers will open the data into columns the way you want, without the extra step of renaming the file on your desktop.
    While some files use a second space (ie two in a row) as a delimiter that's a nasty way to delimit. You always want a specific delimiter that is not used within the data element.
    The above is to import numerical data into separate columns. You could use the same method to manipulate a file that contains text. Let's say you had a file with the suffix .txt. In the file are names and addresses.  John Smith 246 Rose Road . You want Name in one column. Address in another.  Look at all the spaces, which ones should be delimiters which not? Are there any delimiters in the file?
    If you open with Pages and choose show invisibles you can see. You might see John Smith --> 246 Rose Road. (the --> will look like a fat arrow in Pages). Numbers will open this file, IF it has .txt as the suffix, based on the Tab,  with name in one column, Address in another.
    Or you might see John*Smith**246*Rose*Road. Even though the creator of this intended two spaces to be a delimiter Numbers does not recognize that. Numbers will put everything into one column. The fix? In Pages, put a tab between name and address. Find/replace two spaces with Tab. Export, as Text.
    Based on what you see (with show invisible active) in Pages, you can use the Find/Replace function to create the specific delimiter you want (tab or comma). You can use that function to manipulate the file easily so the data you want shows up in separate columns. You may need to get clever to accomplish the unique delimiters. You might even need to do two passes with Find/Replace.
    In the instance above  if there was only one space between each element. (not two as a pseudo delimiter) You could replace all spaces with a tab in Pages. Export as Text.  Numbers will open that file with a column for each word (one for John, one for Smith). Then  "Merge" the two cells (columns) you want to put back together. 

  • How to Compare 2 CSV file and store the result to 3rd csv file using PowerShell script?

    I want to do the below task using powershell script only.
    I have 2 csv files and I want to compare those two files and I want to store the comparision result to 3rd csv file. Please look at the follwingsnap:
    This image is csv file only. 
    Could you please any one help me.
    Thanks in advance.
    By
    A Path finder 
    JoSwa
    If a post answers your question, please click &quot;Mark As Answer&quot; on that post and &quot;Mark as Helpful&quot;
    Best Online Journal

    Not certain this is what you're after, but this :
    #import the contents of both csv files
    $dbexcel=import-csv c:\dbexcel.csv
    $liveexcel=import-csv C:\liveexcel.csv
    #prepare the output csv and create the headers
    $outputexcel="c:\outputexcel.csv"
    $outputline="Name,Connection Status,Version,DbExcel,LiveExcel"
    $outputline | out-file $outputexcel
    #Loop through each record based on the number of records (assuming equal number in both files)
    for ($i=0; $i -le $dbexcel.Length-1;$i++)
    # Assign the yes / null values to equal the word equivalent
    if ($dbexcel.isavail[$i] -eq "yes") {$dbavail="Available"} else {$dbavail="Unavailable"}
    if ($liveexcel.isavail[$i] -eq "yes") {$liveavail="Available"} else {$liveavail="Unavailable"}
    #create the live of csv content from the two input csv files
    $outputline=$dbexcel.name[$i] + "," + $liveexcel.'connection status'[$i] + "," + $dbexcel.version[$i] + "," + $dbavail + "," + $liveavail
    #output that line to the csv file
    $outputline | out-file $outputexcel -Append
    should do what you're looking for, or give you enough to edit it to your exact need.
    I've assumed that the dbexcel.csv and liveexcel.csv files live in the root of c:\ for this, that they include the header information, and that the outputexcel.csv file will be saved to the same place (including headers).

  • 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

  • Mav Contacts does not import csv file

    Trying to import my Outlook exchange contacts to Mavericks Contacts.  Exported from outlook to excel. Saved excel file to csv format.  Tried to import csv file to Mavericks Contacts:  Error message says the csv file is not compatible.  Also imported the csv file to Numbers and saved again as another csv file.  Same error message.  Suggestions?

    The following was copied from the Contacts Help.
    Import contact information saved or exported from other apps. The files can be in LDAP Interchange Format (LDIF) or text format (tab-delimited or comma-separated value (CSV)).
    If you’re importing a tab-delimited or CSV file, make sure it’s formatted correctly using a text editor such as TextEdit.
    Remove any line breaks within a contact’s information.
    Make sure that fields in a tab-delimited file are separated by a tab, instead of by another character. Don’t include spaces before or after tabs.
    Make sure that fields in a CSV file are separated by a comma, instead of by another character. Don’t include spaces before or after commas.
    Make sure all addresses have the same number of fields. Add empty fields as needed.
    In Contacts, choose File > Import, select the file, change the encoding if necessary, then click Open.
    If you’re importing a text file, review the field labels.
    If the first card contains headers, make sure the headers are correctly labeled or marked “Do not import.” Any changes you make to this card are made to all cards in the file. To not import the headers card, select “Ignore first card.”
    To change a label, click the arrows next to the label and choose a new label. If you don’t want to import a field, choose “Do not import.”

  • Load data with SQL Loader link field between CSV file and Control File

    Hi all,
    in a SQL Loader control file, how do you specify link with field in CSV file and Control file?
    E.g. if I wat to import the record in table TEST (col1, col2, col3) with data in csv file BUT in different position. How to do this?
    FILE CSV (with variable position):
    test1;prova;pippo;Ferrari;
    xx;yy;hello;by;
    In the table TEST i want that col1 = 'prova' (xx),
    col2 = 'Ferrari' (yy)
    col3 = default N
    the others data in CSV file are ignored.
    so:
    load data
    infile 'TEST.CSV'
    into table TEST
    fields terminated by ';'
    col1 ?????,
    col2 ?????,
    col3 CONSTANT "N"
    Thanks,
    Attilio

    With '?' mark i mean " How i can link this COL1 with column in csv file ? "
    Attilio

Maybe you are looking for

  • LR5 - Photos in 2nd Display are blurry / don't render completely - intermittent issue

    Just upgraded to Lightroom 5, and the performance issues I saw in 4 appear to be gone - which is awesome. I've come up on an issue that I've seen referenced in other posts, but only for LR4. Also, the issue seems to be slightly different than mine. M

  • Halftones

    I was working in Photoshop and trying to resize an image to fit into the the Large Album iPhoto book. Photoshop's Image Resize Assistant asked me which halftone screen (LPI) will be used to print the image. It offered me the choice of 65, 85, 133, 15

  • MySql / Oracle special characters

    Searched all around, my apologies if this is a redundant thread. I have an Oracle (10.2.0.3) database set up to connect to MySql (4.1) database using HSODBC. Using the 3.51 MySql driver. Has a couple bugs. Distributed transactions, erroneous record c

  • Set picture for non domain users

    Hey, To start I'm running Exchange 2010, not 2013. But am running Office 2013. (So Outlook 2013) I was wondering if it was possible to set a picture for email addresses that are external. Like any person email account (yahoo, Hotmail, live, gmail, et

  • Missing Text and Blank Menu Items

    I'm using the UK English version of Windows 8 64bit. The Creative Cloud Desktop app seems to suffer from a number of blank labels and menu items. Here's the main menu: By trial-and-error, I can find the prefences option, which presents me with this: