export-to-csv

export table to csv on postgres

独自空忆成欢 提交于 2019-12-04 09:08:43
问题 How can I export a table to .csv in Postgres, when I'm not superuser and can't use the copy command? I can still import the data to postgres with "import" button on the right click, but no export option. 回答1: Use psql and redirect stream to file: psql -U <USER> -d <DB_NAME> -c "COPY <YOUR_TABLE> TO stdout DELIMITER ',' CSV HEADER;" > file.csv 回答2: COPY your_table TO '/path/to/your/file.csv' DELIMITER ',' CSV HEADER; For more details go to this manual 回答3: Besides what marvinorez's suggests in

Join two dataframes before exporting as .csv files

心不动则不痛 提交于 2019-12-04 08:42:44
I am working on a large questionnaire - and I produce summary frequency tables for different questions (e.g. df1 and df2). a<-c(1:5) b<-c(4,3,2,1,1) Percent<-c(40,30,20,10,10) df1<-data.frame(a,b,Percent) c<-c(1,1,5,2,1) Percent<-c(10,10,50,20,10) df2<-data.frame(a,c,Percent) rm(a,b,c,Percent) I normally export the dataframes as csv files using the following command: write.csv(df1 ,file="df2.csv") However, as my questionnaire has many questions and therefore dataframes, I was wondering if there is a way in R to combine different dataframes (say with a line separating them), and export these to

Export-CSV only gets the “Length”

梦想的初衷 提交于 2019-12-04 07:09:39
问题 when I try to export to a CSV list, I only get all number for "Length" .Count property until the split point is reached, then split the CSV array to a new file with a new name that will be used from this point on. What might be the issue? $RootFolder = Get-Content "c:\DRIVERS\myfile.txt" foreach ($arrayOfPaths in $RootFolder){ $csv = $arrayofPaths -replace '^\\\\[^\\]+\\([^\\]+)\\([^\\]+).*', 'C:\output\Company_name_${1}_${2}.csv' $csvIndex = 1 $maxRows = 1000000 $rowsLeft = $maxRows Get

Problem exporting a lot of data from database to .csv with java

左心房为你撑大大i 提交于 2019-12-04 04:53:59
问题 I, thank for your attention. I want to export a lot of data, really a lot of data (6 million of rows) to a .csv file using java. The app is a swing application, with JPA, using toplink (ojdbc14). I have tried to use: BufferedWriter RandomAccessFile FileChannel etc etc, but the consumption of memory remains very high, causing a Java Heap Out of Memory Exception, although I set the maximun heap size in 800m (-Xmx800m). My last version of the souce code: ...(more lines of code) FileChannel

How to data Export to CSV using JQuery or Javascript

僤鯓⒐⒋嵵緔 提交于 2019-12-04 03:43:08
What I needed: We have value in the response.d that is comma deliminated value. Now I want to export the data of response.d to .csv file. I have written this function to perform this. I have received the data in response.d but not exporting to the .csv file, so give the solution for this problem to export data in .csv file. function BindSubDivCSV(){ $.ajax({ type: "POST", url: "../../WebCodeService.asmx / ShowTrackSectorDepartureList", data: "{}", contentType: "application/json; charset=utf-8", dataType: "json", success: function (response) { alert(response.d);//export to csv function needed

how to use comma in csv columns [duplicate]

时光怂恿深爱的人放手 提交于 2019-12-04 00:07:35
This question already has answers here : Closed 7 years ago . Possible Duplicate: Dealing with commas in a CSV file We are exporting a bulk data into a csv file for one of our projects. So in this case we have to export values like a,b,c,d which all have to be remain in one column. But the comma will separate them to different columns. Like if we export some values entered in textarea or editor which contains character like \r\n will be exported as separate rows in csv. How can i solve this problem?? The most common way to handle this is to use "" around the field, but depending on who is

Exporting a dojo datagrid to a CSV file

夙愿已清 提交于 2019-12-03 21:35:37
I am looking to get a Javascript function which will export my datagrid (zero.grid.DataGrid) full of data into a CSV file or something similar which can be opened by a spreadsheet application. Is there any standard way of doing this out there.. I had tough time with using Exporter plugin with EnhancedGrid using servlet as backend. Finally I made it work by using iFrame: <!DOCTYPE HTML> <html lang="en"> <head> <meta charset="utf-8"> <title>CISROMM - Master Milestone List Editor</title> <!-- Include dojo dependencies --> <link rel="stylesheet" href="js/dojoroot/dojo/resources/dojo.css"> <link

Prompt a csv file to download as pop up using node.js and node-csv-parser (node module)

做~自己de王妃 提交于 2019-12-03 18:29:57
问题 Recently I have started working with node.js. While going through a requirement in one of my projects I am facing an issue where I should be able to write some data to a csv file dynamically and let it prompt as a popup to download for user (with save and cancel options - as we normally see). After googling for some time I decided to use csv npm module https://github.com/wdavidw/node-csv-parser. I am able to write data into a file and save it using this module. I want to prompt a popup for

PHP fputcsv encoding

自作多情 提交于 2019-12-03 16:18:20
I create csv file with fputcsv. I want csv file to be in windows1251 ecnding. But can't find the solution. How can I do that? Cheers Mihai Iorga Default encoding for an excel file is machine specific ANSI, mainly windows1252 . But since you are creating that file and maybe inserting UTF-8 characters, that file is not going to be handled ok. You could use iconv() when creating the file. Eg: function encodeCSV(&$value, $key){ $value = iconv('UTF-8', 'Windows-1252', $value); } array_walk($values, 'encodeCSV'); It's Working: Enjoy use this before fputcsv: $line = array_map("utf8_decode", $line);

Export JSON to CSV or Excel with UTF-8 (e.g. Greek) encoding using JavaScript

删除回忆录丶 提交于 2019-12-03 15:48:42
问题 I am trying to export and download a JSON object to CSV file and I have problem with Greek characters. My code works; it is not perfect, but it works. The problem is that Greek characters looks like junk. Here is my existing code: function downloadJsonToCsv(jsonObject) { var array = typeof jsonObject != "object" ? JSON.parse(jsonObject) : jsonObject; if (array == null) { return; // No data found on the jsonObject } var str = ""; for (var i = 0; i < array.length; i++) { var line = ""; for (var