export-to-csv

Return variable value from second powershell script to first PowerShell script?

大城市里の小女人 提交于 2019-12-20 06:38:44
问题 I created 1.ps1 script which calls 2.ps1 script. After calling 2.ps1 it give some result in $variable . I want this $variable result to be used in my 1.ps1 for manipulation. $csv = Get-Content \\10.46.198.141\try\windowserver.csv foreach ($servername in $csv) { $TARGET = $servername $ProfileName = "CustomPowershell" $SCRIPT = "powershell.exe -ExecutionPolicy Bypass -File '\\10.46.198.141\try\disk_space.ps1' '$servername'" $HubRobotListPath = "C:\Users\Automation\Desktop\hubrobots.txt"

How to send saved CSV file via email or upload with Google Drive in Android?

北城余情 提交于 2019-12-20 05:48:09
问题 I have a simple logging app that collects data into three arraylists, which I want saved to a CSV file and then shared to Google Drive, email, etc. Here is how I save the data: StringBuilder data = new StringBuilder(); data.append("Timestamp,Mass,Change in Mass\n"); for(int i = 0; i < mass_list.size(); i++){ data.append(String.valueOf(timestamp_list.get(i))+ ","+String.valueOf(mass_list.get(i))+","+String.valueOf(mass_roc_list.get(i))+"\n"); } FileOutputStream out = openFileOutput("scale.csv"

List physical drive space

只谈情不闲聊 提交于 2019-12-20 04:56:43
问题 I have around 200 servers and I need to get the disk space & logical drive space details (free space, used space & total space). Here is my PowerShell query. $infoObjects = New-Object PSObject foreach ($machine in $servers) { $counts = Get-WmiObject -Query "SELECT * FROM Win32_DiskDrive" -ComputerName $machine $total_disk = @($counts).Count $i = 0 $total_disk = $total_disk -1 for (; $i -le $total_disk; $i++) { $a = $i $a = Get-WmiObject -Query "SELECT * FROM Win32_DiskDrive WHERE DeviceID='\\

Write .csv in a for loop

家住魔仙堡 提交于 2019-12-20 04:34:53
问题 I want to write csv files in a for loop. Say I have a data frame data with 3 rows, to make it simple, of a variable x . In the end, I want my output to be 200 .csv files, each one containing a row of the data. The first column of the data is the identification ("ID") of my variables. Furthermore, my data is described as the following: data: ID x [1] a 1 [2] b 2 [3] c 3 for (i in nrow(data)){ write.csv(data[i,2], file = paste0("Directory/", "data[i,1], ".csv")) } I run this code and a csv file

Save all data frames in list to separate .csv files

一笑奈何 提交于 2019-12-19 10:57:19
问题 I have a list of data frames that I want to save to independent .csv files. Currently I have a new line for each data frame: write.csv(lst$df1, "C:/Users/.../df1") write.csv(lst$df2, "C:/Users/.../df2") ad nauseam Obviously this isn't ideal: a change in the names would mean going through every case and updating it. I considered using something like lapply(lst, f(x) write.csv(x, "C:/Users/.../x") but that clearly won't work. How do I save each data frame in the list as a separate .csv file?

Converting XLSX file using to a CSV file

时光怂恿深爱的人放手 提交于 2019-12-19 08:03:15
问题 I need to convert an XLSX file to another CSV file. I've done a lot of research on how to do this process, but I did not find anything that suited me. I found this Github Gist only Convert an Epplus ExcelPackage to a CSV file That returns an Array of binary. But apparently it does not work any more. I'm trying to load Array using LoadFromCollection FileInfo novoArquivoCSV = new FileInfo(fbd.SelectedPath); var fileInfoCSV = new FileInfo(novoArquivo + "\\" + nameFile.ToString() + ".csv"); using

Ruby: How to generate CSV files that has Excel-friendly encoding

大城市里の小女人 提交于 2019-12-18 22:36:53
问题 I am generating CSV files that needs to be opened and reviewed in Excel once they have been generated. It seems that Excel requires a different encoding than UTF-8. Here is my config and generation code: csv_config = {col_sep: ";", row_sep: "\n", encoding: Encoding::UTF_8 } csv_string = CSV.generate(csv_config) do |csv| csv << ["Text a", "Text b", "Text æ", "Text ø", "Text å"] end When opening this in Excel, the special characters are not being displayed properly: Text a Text b Text æ Text Ã

Live Plot in Python GUI

孤者浪人 提交于 2019-12-18 17:36:13
问题 I am trying to write a Python GUI and I need to do a live plot. I currently have a program that receives data from a machine I am using and I want to be able to plot the values the machine outputs as I receive them. I have been researching and from what I have found so far, it doesn't seem to me like tkinter or any library can do this in a GUI. Does anyone know whether and how tkinter can do this or if there is another library that is capable of doing such a live plot? Also, how would I go

How to make fputcsv “echo” the data

匆匆过客 提交于 2019-12-18 14:12:49
问题 I need a way to make the fputscv function write data to the browser on-the-fly instead of creating a temporary file, saving data into that file and doing a echo file_get_contents() . 回答1: Found this on the PHP docs website, first comment under the function reference: function outputCSV($data) { $outstream = fopen("php://output", 'w'); function __outputCSV(&$vals, $key, $filehandler) { fputcsv($filehandler, $vals, ';', '"'); } array_walk($data, '__outputCSV', $outstream); fclose($outstream); }

Use psql's \copy for a multi-line query

╄→гoц情女王★ 提交于 2019-12-18 12:46:15
问题 This is a follow-up question from this answer for "Save PL/pgSQL output from PostgreSQL to a CSV file". I need to write a client-side CSV file using psql's \copy command. A one liner works: db=> \copy (select 1 AS foo) to 'bar.csv' csv header COPY 1 However, I have long queries that span several lines. I don't need to show the query, as I can't seem to extend this past one line without a parse error: db=> \copy ( \copy: parse error at end of line db=> \copy ( \\ \copy: parse error at end of