All Questions
Tagged with csv powershell
3,515 questions
2
votes
1
answer
46
views
Having an issue displaying a part of a string read in from a csv file
I have a table that contains 4 columns in csv format.
I read in the rows and write them to a server by converting them to json and writing it.
The rows are built of:
name
Hash (in sha256 format)
...
2
votes
2
answers
78
views
How to put data from CSV to JSON?
I have a CSV containing two "columns" 'User id' and 'email' example:
User id,email
1234-1234-1234,[email protected]
321-1235-44432,[email protected]
322136231345,[email protected]
...
0
votes
1
answer
81
views
Converting a UTF-8-CSV to UTF-16 (Unicode) in PowerShell
To whom it may concern,
I want to convert my CSV, which is in UTF-8, into UTF-16 using PowerShell. For this task, I wrote the following line of code:
$schuelerCSVUTF8 = Get-Content -Path "C:\tmp\...
1
vote
1
answer
68
views
Import multiple rows from CSV to SQL Server and create a new ID for each one
I'm trying to extract several "agent" rows from a .CSV file and send them to SQL Server, but the .CSV file Num Contrat.csv may be the same for several agents, whereas it must be unique in ...
3
votes
3
answers
69
views
How to prevent Import-Csv ignores empty lines?
Background
I have a CSV file that contains both empty line and line breaks in cells like this:
Richard Roe
Mary Major
"Alex Smith
Betty Brown
Chris Clark"
"Betty Brown
Donna Davis
...
0
votes
1
answer
114
views
Powershell - Create new user accounts from CSV & simultaneously populate these new accounts with template account info (Address & group membership)
I can create user accounts with a CSV ok in Powershell.
I can also create an account from a template account in Powershell, and the info like address & group memberships comes across ok.
However, ...
2
votes
1
answer
45
views
Replace Words in File Names Based on Imported CSV
I have a series of .pdf files where the name contains an old file number, and I'd like to convert it to the new file number. However, I only want to change the file number portion, I don't want to ...
1
vote
1
answer
33
views
Logging from existing CSV and script to CSV - PowerShell
I'm trying to build some logging with trackers for a process here. The logging will take data from an existing CSV, data from the script output, and compare them so that if there is a duplicate it ...
1
vote
2
answers
87
views
remove the first character of each .txt file with Powershell
I have 50 files in a folder that has to be loaded to SQL.
In most of the file(but not in all) the very first character is a hashtag that i would like to delete because it creates difficulty in the ...
-3
votes
1
answer
48
views
Powershell split data from column into multiple column [closed]
I have issue with one of my CSV which is exported from 3rd part tool vendor.
Data looks like below
FQDN Days
device_1 Fri 20:00-23:59; Sat 00:00-23:59; Sun 00:00-23:59, Mon 00:00-07:00
...
1
vote
0
answers
22
views
Powershell still outputting weird characters despite being set for Unicode [duplicate]
In Powershell I'm trying to output a simple bullet (•) to be appended to a string.
However, when I run the code, instead of showing the bullet I see:• instead.
Earlier on in the code, I have the ...
0
votes
1
answer
48
views
Script to read a CSV file and delete particular rows
I have got a csv file (records .csv) which has 400,000 records without any header and each row in it looks like below format:
"1","222","",3333","666",777&...
1
vote
1
answer
56
views
How do I get PowerShell to create a new CSV file?
I'm currently trying to figure out how to get PowerShell to create a new CSV file, and append information to the CSV file it creates. I'm doing this on a test script right now just to try and figure ...
0
votes
2
answers
47
views
How to build a CSV output that can count when a repeat is added PowerShell
Working on building a script to export to a continued CSV file that counts when an IP is added more than once. The script will add the IP to a new line but the 'Total' count will go up by 1 each time ...
1
vote
1
answer
144
views
Cannot bind parameter 'RemainingScripts'
I'm trying to write contacts from a CSV to the web interface for a Cisco phone. The script is-
Script
Error
Any help is greatly appreciated!
This script was originally designed to run in Python, ...
0
votes
0
answers
55
views
Powershell script: I have a CSV that I get with a list of emails and I want to iterate over it. to email each user separately
$CSV = "Rootfile.csv" # creates a variable with the File location
$EmptyColumns = "Hired", "Manager Email" # Picks the columns with empty spaces to parse through
$...
1
vote
2
answers
74
views
Performance issues saving and reading into .csv file (1.5 milion lines)
I need to use Powershell to receive a load of data up to 1 500 000 rows, save into as a file (with correct CLRF encoding), and them immidately after use this file with another command. I find it hard ...
0
votes
0
answers
42
views
Invoke-WebRequest pivot results
I need simple script which will execute Invoke-WebRequest command for each site saved in file.txt to display og:description from sites from file.
So far I dont have loop, but I am able to fetch og:...
0
votes
0
answers
33
views
The member "0" is already present [duplicate]
I have a powershell code that reads in a file and for every record it processes it executes a "piconfig" utility command with the record as part of that commmand. However it stops running ...
0
votes
0
answers
55
views
Nested JSON/array to CSV
I'm making API calls in a for loop and exporting some of the fields from each call to a CSV file.
$csvres = foreach ($a in $k) {
$uri = "https://......./"+$k
$ApiRes = Invoke-...
0
votes
4
answers
76
views
Need to create a foreach loop for a CSV file, using 2 variables, in Powershell
I am new to coding and most of my experience is with Python.
I am working on a simple powershell script that runs a Test-NetConnection on IP address and ports in a CSV file.
IP
Port
1.1.1.1
22
1.1....
0
votes
1
answer
52
views
Exporting CSV results to two different paths
I have a PowerShell script that I would like to export to two different CSV files. One of them also includes an additional parameter to append. I've tried this and it does create a second CSV, but it'...
1
vote
2
answers
85
views
Split columns of a table into multiple columns
I'm trying to code a powershell script that can iterate through the whole table, find every column with multiple values (they're delimited either by ";" or "/") and split them. but ...
2
votes
2
answers
114
views
Null .csv files when extracting node data from .xml files
Trying this again. Ok so I have a powershell script that processes .xml files in a directory. For each .xml file the script processes it is looking for every instance of <AuditRecord> and ...
0
votes
1
answer
28
views
Add string to CSV via PSCustomObject
Currently trying to figure out how to export a string to a CSV file. I'm working on a larger script, and I'm putting together a mini test script to figure this part out. I know how to get PowerShell ...
2
votes
1
answer
58
views
Parsing .XML to .CSV Writing Nodes to Columns
I'm at my wits' end here. Try to parse a large xml file with blocks into a .csv file. Each child node found should have its own columns. Not exactly sure why I am unable to have the inner text be ...
0
votes
0
answers
38
views
Why does csv consider data in one column to be an empty string
I have a powershell script, which basically takes an xlsx file with data, converts it to csv and then fills certain cells in another (template) xlsx file with values from certain columns. There are ...
1
vote
1
answer
72
views
How to get list of users from CSV file whose LastSignInDate column has a date that is before 90 days from current date or is empty?
I have the below PowerShell Code which returns the list of my active users along with their LastSignInDate and some of them as blank value in LastSignInDate column.
Like shown below, I want to further ...
0
votes
1
answer
65
views
Powershell - iterate through CSV file
i'm sruggeling with some script that checks NW connectivity between hosts basicaly i have CSV with source IP and port which looks like this
the problem is when i run this script it checks me every ip ...
0
votes
1
answer
67
views
Webscrape table with powershell
My goal is webscrape this page and collect the data in the first table and export as a csv file:
https://www.interactivebrokers.co.uk/en/trading/margin-futures-fops.php
Margin Requirements
Chicago ...
1
vote
1
answer
144
views
How can I obtain the field value in a tab delimited file via PowerShell?
I have a tab delimited file with three fields in each record. I need to obtain the value of the second field so I can parse it to create two new fields at the end of the record. Once I am able to ...
3
votes
3
answers
89
views
Renaming string via key/value matrix
I am attempting to rename strings that have been pulled from a user-defined field. So, I have set up a matrix that creates a relationship between what comes from the UDF and what I want that string to ...
0
votes
2
answers
56
views
Prefix lines of a CSV with a string but after every 99 lines, use another string
This is based on another thread. I didn't want to muddy that one with another question as that one was already solved.
Basically, I got burned by the system into which these CSVs get pulled. I think ...
0
votes
0
answers
22
views
powershell m365 user import doesn't work because of userprincipalname
Please check de picture below. Why it keep giving this error?
enter image description here
I tried different variables:
$_.UserPrincipalName
$UPN
1
vote
2
answers
231
views
Powershell Sort-Object is not sorting a PSCustomObject if explicitly casting the column to [double]
Edit: I've updated the code sample to remove confusing pseudocode and added a few comments in the code.
I apologize for the long code sample. I tried to include pertinent information while cutting ...
0
votes
0
answers
102
views
Using Invoke-sqlcmd occasionally outputs a blank csv file
I'm fairly new to using powershell so bear with me. My goal is to query a database over our network and save the file output of the query as a csv on the local machine. The query works as intended but ...
0
votes
1
answer
95
views
How to get PowerShell to change cell value in CSV
I'm trying to make PowerShell interact with a CSV file and update it's values. There are four columns in the CSV: "Object Name", "Times Flagged", "Date Last Flagged", and ...
0
votes
0
answers
39
views
How to get PowerShell to compare data from CSV
I'm currently working on a script that will take object names from a txt file, compare them to entries in a CSV file, ID which objects from the txt already have entries in the CSV, update existing ...
2
votes
2
answers
104
views
How do I Join Cells from different rows in PowerShell
I am fairly new to PowerShell and just trying to get plug some gaps with my main support role using PowerShell, so far its been great however I am currently stuck on trying to find a solution for the ...
0
votes
0
answers
89
views
All data in one column in CSV file due to formatting of the source file
I receive a CSV file from a colleague that containing sales data. This data I then need to read in to a data table using Powershell.
The format of the file looks like this:
","""&...
0
votes
1
answer
218
views
Az Powershell - not able to read CSV file contents
I am trying to get contents of a backedup CSV users file and compare it with current settings and want to assign (unassigned users). I am accessing this CSV file from file storage - though the file is ...
0
votes
2
answers
67
views
Only write over data to csv line without losing previous data?
I have a starting csv with sample data like so:
Underlying,AllBlue,AllRed
AUD,1/5/2024,
BRR,,
GBP, 3/10/2024,
CAD,,
Today, 2024/04/29, via another process, a new CSV is produced, like this for ...
0
votes
1
answer
76
views
PS - Import CSV with quotes
I have a few files which I should import into a database. The files are 30-40MB.
CSV files' delimiter is tabulator.
For example:
Header1
Header2
Header3
1
rand name
5674
2
his name
663452
3
"...
0
votes
1
answer
68
views
Why can't my PowerShell script detect the property of my CSV header?
I am trying to the the below script to write to a CSV file with 3 headers but keep getting the following error 'The property 'exit' cannot be found on this object. Verify that the property exists and ...
0
votes
2
answers
52
views
Having an issue with delimiters in CSV and powershell
Having an issue with getting a csv that is converted from an email into a readable report, the script functions mostly but returns System.Object[] in all three columns instead of the value when I try ...
1
vote
2
answers
35
views
Create Grouped Averages from CSV data using Powershell
I have a CSV file similar to this:
Name,Dates,Sortino,RoMDD,PctWins
AAL,2017-06-01 - 2018-06-01,-0.47,-0.26,66.67%
AAL,2017-09-01 - 2018-06-01,0.03,0.02,66.67%
AAL,2017-12-01 - 2018-06-01,-1.05,-0.69,...
0
votes
1
answer
90
views
Filter data from 1000+ csv files matching consecutive row data
On Windows so may be a Powershell solution?
I have 1000+ csv files in a folder I want to check and get data from.
I've simplified the csv for the purpose of this post, it has 3 columns - row, time and ...
0
votes
0
answers
42
views
Adding numeric values in one CSV to those in another CSV based on matching another value in the same row
I've been tasked with using Powershell to count the number of occurrences where a particular action occurs in an application on a remote system. The count of actions is already being put into a CSV ...
0
votes
1
answer
112
views
Powershell replace sid in csv with username
I have a csv or txt with workstation names and some sids from registry. I want to replace the sids with user names in the original csv. The sids have a ":" at the end and a letter after that,...
0
votes
0
answers
37
views
Split csv into multiple files by date
i have a CSV File which contains the following data:
PERNR;DATE;TIME;EVENT
I want the lines to be seperated by DATE and for each date a seperate file.
e.g.
10.03.24.csv
11.03.24.csv
12.03.24.csv
Can ...