Using Powershell environmental variables as strings when outputting files

js2010’s answer shows the effective solution: use “…”-quoting, i.e. an expandable string explicitly. It is a good habit to form to use “…” explicitly around command arguments that are strings containing variable references (e.g. “$HOME/projects”) or subexpressions (e.g., “./folder/$(Get-Date -Format yyyy-MM)”) While such compound string arguments generally do not require double-quoting[1] – because they are … Read more

How to Export JSON to CSV or Excel – Angular 2

I implemented excel export using these two libraries: file-server and xlsx. You can add it to your existing project with: npm install file-saver –save npm install xlsx –save ExcelService example: import { Injectable } from ‘@angular/core’; import * as FileSaver from ‘file-saver’; import * as XLSX from ‘xlsx’; const EXCEL_TYPE = ‘application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8’; const EXCEL_EXTENSION = … Read more

Export HTML table to CSV using vanilla javascript

Should work on every modern browser and without jQuery or any dependency, here my implementation : // Quick and simple export target #table_id into a csv function download_table_as_csv(table_id, separator=”,”) { // Select rows from table_id var rows = document.querySelectorAll(‘table#’ + table_id + ‘ tr’); // Construct csv var csv = []; for (var i = … Read more