GithubHelp home page GithubHelp logo

yasarshaikh / pscsv Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sfxd/pscsv

0.0 1.0 0.0 21 KB

A user-configurable powershell script that allows you to replace values from a column by a match from a map, sanitize dates, and remove null values.

License: Mozilla Public License 2.0

PowerShell 100.00%

pscsv's Introduction

PSCSV

Version

A powershell script to help Salesforce admins and consultant to save time and do data load operations without having to rely on Excel.

Current list of stuff the script can do: - transcode a file from one encoding or separator to another - remap values in a column from one to another - reformat Dates from whatever format to the salesforce format - reformat Date Times from whatever format to the salesforce format - replace whatever you want in a column with "" - great if someone is sending you files with null.

Function

This script takes no arguments. The configuration is done via one JSON file and multiple CSV files, based on what you want to do. The Config dir contains the configuration files.

  • vars.json contains the basic config:

    • the path to your files (windows users, replace "" with "/");
    • the delimiter of the input and output files;
    • the encoding of the input and output files;
    • switches to control what the script will do.
  • mapconf.csv defines which column in the csv should be replaced by which map (itself a csv file, stored in "maps" dir)

  • dateconf.csv defines a column to look in for a date that needs to be reformatted. It understands any variation of dd-MM-YYYY or d MMMM yy, etc.

  • datetimeconf.csv is the same as dateconf but reformats to datetime in format YYYY-MM-DDTHH:MM:SSZ.

  • nullconf.csv defines a regex that is used to select what to delete in a specified column.

If the script encounters an error, it will dump the line number and the values of the mapping, as well as the error, before pausing the script.

Advantages

The script does not care for column order as it uses the columns header to target replacements. It does not requires formulas, that's what it does. Unlike spreadsheet software, it won't fuck up your dates or phone numbers. It only does what is written above, but it does it well. Even non scripters can use it thanks to the config file.

The script can, with minor modification, open a file with a wrong delimiter or encoding, and save it back to proper UTF8 csv.

pscsv's People

Contributors

windyo avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.