PHPExcel doesn't delete last column - phpexcel
I successfully delete all other blank columns, however, I keep getting a 0 on the last column and last row (everything else in that column is deleted = a few others zero's, except the last one). I've tried to delete it manually $objPHPExcel->setActiveSheetIndex($index)->removeColumn('N', 1); but it's still there. I've read that this is an issue, but has anyone found a way to correct it?
Related
Dataframe has an empty cell, how to replace with 0?
I have a dataframe that is sourced from an excel CSV file. because of how I build the source file, some of the columns will come in with blanks (i.e. I didnt put anything in that cell in excel). I need to set those cells to 0 before I process the data. I read the data in using fread. Some of the cells have come in with N/A in the value which is easy enough to replace. However some show "blank" in View(theDataFrame) and are not caught by replace_na. I cant figure out what is in these cells so i can target them and replace with 0. I tried paste("*", theDataFrame[1, "Current Price"], "*") which printed an asterisk, two white spaces and another asterisk. so, I tried gsub("/s/s", "0", theDataFrame$`Current Price`) but that did not work. is.empty(theDataFrame[1, "Current Price"]) is FALSE so, it's not empty. How can i figure out what the heck fread put in there so I can replace it? Thanks!
We could use theDataFrame[theDataFrame == ''] <- 0
R - Update column by looping through it
I want to update a column value in such a way that only the part of a string after the last '.' is stored. I wrote a code that does this but it only works when it's given one input. How do I loop through all the rows of my dataframe? One value of a row looks for example like this. I only want to store the last part ".gif" GET /./enviro/gif/emcilogo.gif I wrote the following code that succesfully does this. tail(c(do.call(rbind, strsplit(as.character(sapply(strsplit("GET /./enviro/gif/emcilogo.gif", "\\s+"), `[`, 2)),"\\."))), n=1) Output: "gif" However, I am using the string "GET /./enviro/gif/emcilogo.gif" as input. As soon as I change this to the column of my dataframe "df$request" I receive the error. Error in strsplit(epa.df$request) : argument "split" is missing, with no default I tried writing a function that one-by-one loops through my column values and updates them. However, I cant seem to get this working. Any help would be highly appreciated!
R can't read random columns of my CSV file
R thinks that the columns "nonrow" (which I added as a tester) and "sample" don't exist (it says they're null) in the following CSV file. (It sees every other column fine...) nonrow,,Fill Weight,Fill Weight,Fill Weight,Fill Weight,xbar,r,sample 0,,352,348,350,351,350.25,3,1 0,,351,352,351,350,351,2,2 0,,351,346,342,350,347.25,8,3 0,,349,353,352,352,351.5,1.5,4 0,,351,350,351,351,350.75,1,5 0,,353,351,346,346,349,5,6 0,,348,344,350,347,347.25,6,7 0,,350,349,351,346,349,5,8 0,,344,345,346,349,346,4,9 0,,349,350,352,352,350.75,2,10 0,,353,352,354,356,353.75,4,11 0,,348,353,346,351,349.5,7,12 0,,352,350,351,348,350.25,3,13 0,,356,351,349,352,352,3,14 0,,353,348,351,350,350.5,3,15 0,,353,354,350,352,352.25,4,16 0,,351,348,347,348,348.5,1.5,17 0,,353,352,346,352,350.75,6,18 0,,346,348,347,349,347.5,2,19 0,,351,348,347,346,348,2,20 0,,348,352,351,352,350.75,1.25,21 0,,356,351,350,350,351.75,1.75,22 0,,352,348,347,349,349,2,23 0,,348,353,351,352,351,2,24 I have tried moving the column around, renaming it, and trying the tester column (which it also mysteriously can't see). Does anyone have any suggestions? Thank you!
What would cause Microsoft Jet OLEDB SELECT to miss a whole column?
I'm importing an .xls file using the following connection string: If _ SetDBConnect( _ "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & filepath & _ ";Extended Properties=""Excel 8.0;HDR=Yes;IMEX=1""", True) Then This has been working well for parsing through several Excel files that I've come across. However, with this particular file, when I SELECT * into a DataTable, there is a whole column of data, Item Description, missing from the DataTable. Why? Here are some things that may set this particular workbook apart from the others that I've been working with: The workbook has a freeze pane consisting of the first 24 rows (however, all of these rows appear in the DataTable) There is some weird cell highlighting going on throughout the workbook That's pretty much it. I can't see anything that would make the Item Description column not import correctly. Its data is comprised of all Strings that really have no special characters apart from &. Additionally, each data entry in this column is a maximum of 20 characters. What is happening? Is there any other way I can get all of the data? Keep in mind I have to use the original file and I cannot alter it, as I want this to ultimately be an automated process. Thanks!
Some initial thoughts/questions: Is the missing column the very first column? What happens if you remove the space within "Item Description"? Stupid question, but does that column have a column header? -- EDIT 1 -- If you delete that column, does the problem move to another column (the new index 4), or is the file complete. My reason for asking this -- is the problem specific to data in that column/header, or is the problem more general, on index 4. -- EDIT 2 -- Ok, so since we know it's that column, we know it's either the header, or the rows. Let's concentrate on rows for now. Start with that ampersand; dump it, and see what happens. Next, work with the first 50% of rows. Does deleting that subset affect anything? What about the latter 50% of rows? If one of those subsets changes the result, you ought to be able to narrow it down to an individual row (hopefully not plural) by halfing your selection each time. My guess is that you're going to find a unicode character or something else funky is one of the cells. Maybe there's a formula or, as you mentioned, some of that "weird cell highlighting."
It's been years since I worked with excel access, but I recall some problems with excel grouping content into some areas that would act as table inside each sheet. Try copy/paste the content from the problematic sheet to a new workbook and connect to that workbook. If this works you may be able to investigate a bit further about areas.
How to remove Column in crystal report if Column value have NULL
I am dynamically adding columns to a crystal reports data source as explained here Dynamic_Reports. Here i need remove columns whenever i am not filling values to depends upon columns. These columns are i need to remove from a crystal reports at run time. Why i need like this means,I have 20 columns and going fill 1st ,2nd ,19th and 20th columns Only.Rest of them having blank space.blank space[columns] are need to remove.
Include a formula checking null value for the particular column and if null dont insert. These you can check after filling in the database. EDIT: example: If !IsNull({Product.Color}) Or InStr({Product.Color}, " ") != 0 Then totext({Table.Column}) You can drag the required column for which you suspect it will be blank in to the ( ) of IsNull or InStr