Merging cells in phpexcel without losing data - phpexcel

I'm working on symfony with phpexcel, i have some merged cells from B1 to E1 like this :
$phpExcelObject->getActiveSheet()->mergeCells('B2:B5')
And i'm setting data in each cell from B2 to B5, but when i generate excel file i only find data in B2 cell but others are lost, any suggestions?

That's because your merging. Try to add all data in B2 cell and then merge.

Related

Reading blocks of data from multiple CSV files and combining them into a dataframe

I have multiple CSV files that I can read into dataframes. Each resultant dataframe consists of blocks of rows stacked on top of each other and separated by a row of NA's. blocks of each file have the same number of rows (and obviously the same number of columns.) For example, the first dataframe has the following structure:
B1
B2
...
Bn
where Bi is the ith block with p rows, for each i, and blocks are separated by a row of NA's. I don't necessarily know the number of blocks (i.e. n), albeit figuring it out is easy math.
I need to combine all these dataframes into one, by
reading the first block from the 1st df, then reading the first block from the 2nd df, ..., till reading the first block from the last df.
then reading the second block from the dfs sequentially, ...
doing this till all the blocks are stacked on top of each other in one final dataframe.
To make it more clear, assume there are only 2 dfs, where the first one is structured as described above, and the second one has the following structure:
A1
A2
...
An
where each block Aj has q rows and blocks are separated by an NA row (note that p and q are not necessarily the same, but both dfs have the same number of columns.)
The final df should have the following structure:
B1
A1
B2
A2
...
Bn
An
Is there an elegant way of doing this in R without resorting to for-loops?

Why is my csv export from R to Excel showing all the conent from one row in a single cell?

I'm trying to transform my data frame from R to Excel so I used the most obvious way:
write.csv(dataframe, "path")
This is working so far but if I'm opening it on Excel it's just terrible. I'm having 600 rows with 18 columns but Excel shows all the content from one row (so all the columns with different numbers, but also longer string text) in the very first cell, so A1, A2, A3 etc. Why isn't it showing the content from row 1, column 1 in A1 and then row 1, column 2 in A2 and so on?
I'm almost breaking down over this problem since this is the very last step of a quite long work and I don't know what to do. If anyone can help I'd be so grateful!

Subtracting COUNT results in SQLite

In my SQLite query, I create two temp tables, both of which have a column with COUNT results. I then combine these two columns into a new table.
This part of the query works fine: I get the two columns of numbers in my new table.
I named these two columns using as C1 and as C2. But when I add a third calculated column containing the expression C1-C2, this third column contains only zeros.
How can I subtract the numbers using my column names?
How about?
SELECT c1, c2, (c1 - c2) as `difference` FROM table

How to convert Hex to binary in excel 2013 , then save each bit in different cell

I want to convert Hex number to binary and then each bit of that binary should be saved in different cell. is it possible to do in excel 2013.
for e.g.
hexno. B
binary: 1011,
then 1,0,1,1 should be stored separately in a cell.
Say hexadecimal value is in A1 then to convert to binary, say in B1:
=HEX2BIN(A1)
HEX2BIN.
From there you might use a formula in C1 and copy it across to the right as suitable:
=MID($B1,COLUMN()-2,1)
but assuming you have several numbers to deal with I suggest don't fill your sheet with formulae but apply Text to Columns. Copy formula results in ColumnB and Paste Special...., Values over the top. Select ColumnB, DATA - Data Tools, Text to Columns, Fixed width, parse at every required individual character position, Finish.

How to check eliminate several rows from a dataframe using R

I have two excel files A and B. Excel file A has 6 columns with 10,000 rows. Assume that columns are named A-F. Excel file B has one column (A) with 3500 rows. Here is what I want to do-
I want to eliminate rows based on the cell values (ids) in column A (in excel file A) and have a dataframe without them. To further elaborate- I want to check each id in Column A (excelfile A) against all ids in columnA in excel file B. If the id in column A in excel file A matches with any of the listed ids in columnA of excel file B, then, I want to eliminate those rows with matching ids in excel file A.
I was able to do this in excel. I want to do the same with R as a crosscheck. I am new to R and I am learning. Could someone help me with a best way to do this?
I know how to subset rows based on header title and a particular value of a cell. But, in this case, I have data with 10,000 observations, of which, I want to eliminate at least 3500 through matching the ids.

Resources