export-to-csv

Java - Writing strings to a CSV file

送分小仙女□ 提交于 2019-11-26 17:28:23
问题 I am trying to write data to a csv file with java, however when I try opening the produced file with excel I am getting an error saying the file is corrupt. Upon opening the file in notepad it looks to be formatted correctly so I'm not sure what the issue is. I am using the FileWriter class to output the data to the file. FileWriter writer = new FileWriter("test.csv"); writer.append("ID"); writer.append(','); writer.append("name"); writer.append(','); ... writer.append('\n'); writer.flush();

How to export table as CSV with headings on Postgresql?

微笑、不失礼 提交于 2019-11-26 14:50:31
I'm trying to export a PostgreSQL table with headings to a CSV file via command line, however I get it to export to CSV file, but without headings. My code looks as follows: COPY products_273 to '/tmp/products_199.csv' delimiters','; Milen A. Radev COPY products_273 TO '/tmp/products_199.csv' WITH (FORMAT CSV, HEADER); as described in the manual . Laurent Debricon From psql command line: \COPY my_table TO 'filename' CSV HEADER no semi-colon at the end. instead of just table name, you can also write a query for getting only selected column data. COPY (select id,name from tablename) TO 'filepath

How to create and download a csv file from php script?

走远了吗. 提交于 2019-11-26 12:10:06
I am a novice programmer and I searched a lot about my question but couldn't find a helpful solution or tutorial about this. My goal is I have a PHP array and the array elements are showing in a list on the page. I want to add an option, so that if a user wants, he/she can create a CSV file with array elements and download it. I don't know how to do this. I have searched a lot too. But yet to find any helpful resource. Please provide me some tutorial or solution or advice to implement it by myself. As I'm a novice please provide easy to implement solutions. My array looks like: Array ( [0] =>

Powershell: Export a custom object to a CSV file - extract a single property value with Select-Object

非 Y 不嫁゛ 提交于 2019-11-26 11:40:04
问题 I wrote a script that constructs a custom object and exports it to a CSV file: $reg = Get-ItemProperty HKLM:\\SOFTWARE\\McAfee\\DLP\\Agent | Select-Object agentversion $date = Get-ItemProperty \'C:\\Program Files\\McAfee\' | Select-Object {$_.LastWriteTime} $date86 = Get-ItemProperty \'C:\\Program Files (x86)\\McAfee\'| Select-Object {$_.LastWriteTime} New-Object -TypeName pscustomobject -Property @{ \"Number1\"=$reg \"Number2\"=$date86 \"Number3\"=$date } | export-csv -Path C:\\****\\desktop

Writing multiple data frames into .csv files using R

柔情痞子 提交于 2019-11-26 11:19:33
问题 I have used lapply to apply a function to a number of data frames: data.cleaned <- lapply(data.list, shooter_cleaning) And then labeled each of the resulting data frames in the list according to their subject number (e.g., 100): names(data.cleaned) <- subject.names What I want to do is to save each new data frame as an individual .csv file based on its subject number. For example, for subject 100 I\'d like the .csv file to be labeled as \"100.csv\" Normally to do this (for a single data frame

How to export dataGridView data Instantly to Excel on button click?

不问归期 提交于 2019-11-26 10:27:02
问题 I have 10k rows and 15 column in my data grid view. I want to export this data to an excel sheet o button click. I have already tried with the below code. private void btExport_Click(object sender, EventArgs e) { Microsoft.Office.Interop.Excel._Application app = new Microsoft.Office.Interop.Excel.Application(); Microsoft.Office.Interop.Excel._Workbook workbook = app.Workbooks.Add(Type.Missing); Microsoft.Office.Interop.Excel._Worksheet worksheet = null; app.Visible = true; worksheet =

Export-CSV exports length but not name

拈花ヽ惹草 提交于 2019-11-26 09:10:07
问题 I have this code that I am running from powershell. When I run it without the export-csv i get all the folder names on the screen. dir | select -expand fullname | % { ($_ -split \'\\\')[7] But if I add | export-csv c:\\test.txt then I see following in the file not the folder name I expected just like I see it on the screen. #TYPE System.String \"Length\" \"13\" \"18\" \"20\" \"22\" \"29\" \"21\" \"24\" \"11\" \"17\" \"20\" \"20\" 回答1: Export-Csv exports a table of object properties and their

How to export a table dataframe in PySpark to csv?

£可爱£侵袭症+ 提交于 2019-11-26 09:08:05
问题 I am using Spark 1.3.1 (PySpark) and I have generated a table using a SQL query. I now have an object that is a DataFrame . I want to export this DataFrame object (I have called it \"table\") to a csv file so I can manipulate it and plot the columns. How do I export the DataFrame \"table\" to a csv file? Thanks! 回答1: If data frame fits in a driver memory and you want to save to local files system you can convert Spark DataFrame to local Pandas DataFrame using toPandas method and then simply

How to export table as CSV with headings on Postgresql?

◇◆丶佛笑我妖孽 提交于 2019-11-26 04:02:24
问题 I\'m trying to export a PostgreSQL table with headings to a CSV file via command line, however I get it to export to CSV file, but without headings. My code looks as follows: COPY products_273 to \'/tmp/products_199.csv\' delimiters\',\'; 回答1: COPY products_273 TO '/tmp/products_199.csv' WITH (FORMAT CSV, HEADER); as described in the manual. 回答2: From psql command line: \COPY my_table TO 'filename' CSV HEADER no semi-colon at the end. 回答3: instead of just table name, you can also write a

Create objects with custom properties containing derived filesystem path information and export them to a CSV - calculated properties

 ̄綄美尐妖づ 提交于 2019-11-26 01:29:15
问题 Editor\'s note: The gist of this question is: * How do I add custom properties to objects output by Get-ChildItem that contain derived path information, namely the parent folder path (as Folder and name (as Foldername )? * How do I export the resulting objects to a CSV file? Currently have a script running that I took from StackOverflow and modified for my own use. The purpose of the script is to look at a directory, grab file names, then export them to a directory as a .csv file. I was able