I Need to read the first row of signature for example.
After I importet the csv I use $csvcsv.Signature to get the whole Signature column, so far so good but how can I read the first row only and save it into a var?
I also want to delete the first row of Signature after I saved it to the var, and save it to the csv file.
What I tried so far:
$csvcsv.Signature [0] and $csvcsv.Signature [0,1,2,3,4,5]
Awesome Jon that worked, thanks!
I have another challenge, I add with
{
$csvcsv += [PSCustomObject]@{
Dictionary2 = $Datum }
}
values to the csv object and export it afterwards but it seems that I always get a new line for each entrie.
baschi,
probably I’ve got something wrong. What is it what you actually try to achieve?
Of course the types are the same. But $Csv and $NewCsv have a distinct difference. $NewCsv has 1 column more.
thanks Olaf. I try to add one row to a defined column.
F.e.:
add one entry to “Signature” = “20180101” (manipulating the customobject and writing it back to the csv after)
the next step would be to delete the first entry of it.
F.e.:
I added one entry to Signature and have
Siganture
“20180108”
“20180101”
“20180102”
“20180101”
now as I have 4 rows I would like to delete the first one.
Signature
“20180101”
“20180102”
“20180101”
My whish would be something like:
$csv.Signature +=“20180101” but that isn’t working. I think I have to manipulate the object but I don’t know how.
This code always adds another row which is not my goal I want to fill per column.
baschi,
for csv data you cannot delete one single “cell” in one comlumn and leave the rest like it is. You have to tread one line completely at a time. You could make a single cell “empty”. … something like this:
OK, I can imagine something like that but I still don’t understand why you try that hard to delete one cell instead of simply “cleaning” it. Try to think about following sscenario: When you try to delete a cell in Excel it will ask you how would you like to fill up the hole - with cells from the right or from the bottom. How do think Powershell should deal with this dilemma?
Powershell should from my point of view have some option to do this.
I do it cause I use it for versioning. When I have more then 3 rows, so 4, I want to delete the first one and the backup of it.
You can delete the first cell of the column Signature but you would have to delete the rest of this row as well. Do the cells in one row have any relation with each other? If not - a csv data set might be the wrong approach to store the information.