XLSX

How to read multiple xlsx file in R using loop with specific rows and columns

北慕城南 提交于 2019-12-21 23:50:40
问题 I have to read multiple xlsx file with random names into single dataframe. Structure of each file is same. I have to import specific columns only. I tried this: dat <- read.xlsx("FILE.xlsx", sheetIndex=1, sheetName=NULL, startRow=5, endRow=NULL, as.data.frame=TRUE, header=TRUE) But this is for only one file at a time and I couldn't specify my particular columns. I even tried : site=list.files(pattern='[.]xls') but after that loop isn't working. How to do it? Thanks in advance. 回答1: I would

List of data.frame's to individual excel worksheets - R

穿精又带淫゛_ 提交于 2019-12-21 05:05:04
问题 I have a list of data.frame's that I would like to output to their own worksheets in excel. I can easily save a single data frame to it's own excel file but I'm not sure how to save multiple data frames to the their own worksheet within the same excel file. library(xlsx) write.xlsx(sortedTable[1], "c:/mydata.xlsx") 回答1: Specify sheet name for each list element. library(xlsx) file <- paste("usarrests.xlsx", sep = "") write.xlsx(USArrests, file, sheetName = "Sheet1") write.xlsx(USArrests, file,

C# OPENXML XLSX Custom Column width

半城伤御伤魂 提交于 2019-12-21 03:32:46
问题 C# newbie here! I need to create a small console application to convert CSV files into XLSX files. I have all my styles and data working, but I want to set a different (from default) width on some columns. And after a day of searching and reading I still can't figure out how to get it to work. As an example I want to set columns A and C to a width of 30 Set column D to a width of 20 Any help or tips would be great. My code right now below using System; using System.Linq; using DocumentFormat

Error in printing data.frame in excel using XLSX package in R

巧了我就是萌 提交于 2019-12-20 16:19:59
问题 The dataframe is visible with out any error. But when the same is printed using write.xlsx fucnction of the package XLSX, it gives the error. Error in .jcall(cell, "V", "setCellValue", value) : method setCellValue with signature ([D)V not found. The dput of the data.frame looks like: Timestamp qs pqs logqs es p_imp dep r_dep agg_rtn (time) (dbl) (dbl) (dbl) (dbl) (dbl) (dbl) (dbl) (dbl) 1 2015-05-04 09:29:59 0.05788732 0.0007478696 0.0007478545 0.09633803 -0.0446830986 3533.518 274079.9 -0

How to avoid writing a row.names column when saving a data.frame using the xlsx package

空扰寡人 提交于 2019-12-20 10:57:54
问题 I have a data frame like this one below and I really want to remove the row names when I export it to a excel file using the xlsx package. bd <- data.frame(id = 1:200, A = c(rep("One", 100), rep("Two", 100)), B = c(rep(1,50), rep(0, 50), rep(1, 50), rep(0, 50))) I have already tried to use the command below, but it keep them in the first column of the excel file. bd <- data.frame(id = 1:200, A = c(rep("One", 100), rep("Two", 100)), B = c(rep(1,50), rep(0, 50), rep(1, 50), rep(0, 50)), row

How to set cell width when export .xlsx files with js-xlsx

我只是一个虾纸丫 提交于 2019-12-20 09:51:05
问题 I am trying to set a fixed column/cell width to my exported excel files with js-xlsx. EDIT: Here is the source of js-xlsx: https://github.com/SheetJS/js-xlsx 回答1: I found a snippet the the write test here https://github.com/SheetJS/js-xlsx/blob/master/tests/write.js#L14-L19 For quick reference, where ws is your worksheet. var wscols = [ {wch:6}, {wch:7}, {wch:10}, {wch:20} ]; ws['!cols'] = wscols; 回答2: Similar to cell width, you can set the cell height in the following way var wsrows = [ {hpt

PHPExcel CSV to XLSX

谁都会走 提交于 2019-12-19 10:42:51
问题 I have a problem converting file feom CSV to XLSX format: Index.php <?php if (!isset($_FILES["file"])) { ?> <html> <body> <h1>Convert CSV to XLSX</h1> <form action="index.php" method="post" enctype="multipart/form-data"> <input type="file" name="file"/> <input type="submit"/> </form> </body> </html> <?php exit; } //obtain PHPExcel from http://phpexcel.codeplex.com require_once('Classes\PHPExcel.php'); require_once('CSVToExcelConverter.php'); if ($_FILES["file"]["error"] > 0) { echo "Error: "

C# .xml to .xlsx how?

隐身守侯 提交于 2019-12-19 06:19:42
问题 I want to convert a complete XML file to XLSX but I'm not sure how I can do it. I searched at Google for a Solutions but the most time I only find the way into the other direction for example XLSX to XML. On the Microsoft Page I found a xmlconvertclass, but I'm not sure how I can work with the class. Did someone do something like this in the past and can help me? 回答1: Try the Below code in which i converted XML into DataSet and later exported DataSet into Excel DataSet ds = new DataSet(); /

Best way to convert CSV file into XLSX and provide both formats as export for user

人走茶凉 提交于 2019-12-19 03:42:25
问题 I implemented a CSV exporter which works like the following: User triggers CSV export App creates a new background job Job generates CSV using CSV.generate Job saves file on Amazon S3 with paperclip (assign file with StringIO ) User can download CSV after job is done This process works well! Now I need to provide an xlsx export as well I just tried to change the content type for the file to an xlsx format, but I got Content Spoofing errors with paperclip. I am also struggling to set the

How to convert .xlsm (macro enabled excel file) to .xlsx using Python?

我的梦境 提交于 2019-12-19 03:35:22
问题 I am trying to import data in an .xlsm file as a data frame. When I import the .xlsm file using the command below, it gives me an empty data frames as the result: exp = pd.read_excel(File_Path+'file_name'.xlsx',sheetname='Data',header=None) I have manually saved .xlsm files as .xlsx file and imported them as data frame. Can anybody tell me how to save as .xlsm file as .xlsx using Python? 回答1: I would suggest you try using a win32com type approach. If you are on Windows, you can use Python to