Search for a value and move it to another spreadsheet - excel

I have a little problem using Excel 2010. The problem is simple but I think I start in a wrong direction. Let's say I have a document with the following structure:
<table>
<thead>
<th> Col A</th>
<th> Col B</th>
<th> Col C</th>
</thead>
<tr>
<td> NONE</td>
<td> TEST</td>
<td> NONE</td>
<td> TEST2</td>
<td> TEST3</td>
<td> TEST4</td>
</tr>
<tr>
<td> NONE</td>
<td> TEST</td>
<td> NONE</td>
<td> TEST2</td>
<td> TEST3</td>
<td> TEST4</td>
</tr>
<tr>
<td> TEST</td>
<td> TEST</td>
<td> NONE</td>
<td> TEST2</td>
<td> TEST3</td>
<td> TEST4</td>
</tr>
<tbody>
</tbody>
</table>
I want to search for NONE and move it to another spreadsheet. I want to do this with formula. I tried with SEACH but I don't know how to move it to another spreadsheet.

Related

How to remove row gap between two tables in Laravel maatwebsite/excel FromView

I want to export order and order item data in my laravel web app in xls format so i decided to try using maatwebsite/excel v3.1. I'm using FromView class to convert blade template into an excel file, the blade structure looks like this:
<table>
<thead>
<tr>
<th> Order# </th>
<th> Customer </th>
<th> Order Date </th>
<th> Total </th>
</tr>
</thead>
<tbody>
<tr>
<td> 1132 </td>
<td> Ashin </td>
<td> 21-11-2021 </td>
<td> 3000.00$ </td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th colspan="4"> Order Items </th>
</tr>
<tr>
<th> Product </th>
<th> Price </th>
<th> Qty </th>
<th> Subtotal </th>
</tr>
</thead>
<tbody>
<tr>
<td> Bag </td>
<td> 1200.00$ </td>
<td> 2 </td>
<td> 2400.00$ </td>
</tr>
<tr>
<td> Hat </td>
<td> 600.00$ </td>
<td> 1 </td>
<td> 600.00$ </td>
</tr>
</tbody>
</table>
and the results looks like this:
there is a row gap between these two tables, how can i remove it?

Need the full correct html code for this Table

Image table
Please write full html codes for this table. You may see the Table image from above via the link.
<table border="1" width="800">
<tr>
<th>Level1</th>
<th>Level2</th>
<th>Level2</th>
<th>Info</th>
<th>Name</th>
</tr>
<tr>
<td rowspan="6">System</td>
</tr>
<tr>
<td rowspan="4">System Apps</td>
<td rowspan="2">System Memory</td>
</tr>
<tr>
<td rowspan="3">SystemEnv</td>
<td rowspan="1">SystemEnv2</td>
<td rowspan="2">Memeory Test</td>
</tr>
Here is the table code :
<table border="2">
<tr>
<th>Level 1</th>
<th>Level 2</th>
<th>Level 3</th>
<th>info</th>
<th>Name</th>
</tr>
<tr>
<td rowSpan="6">System</td>
<td rowSpan="4">System apps</td>
<td rowSpan="3">SystemEnv</td>
<td>App Text</td>
<td>foo</td>
</tr>
<tr>
<td>App memory</td>
<td>foo</td>
</tr>
<tr>
<td>App test</td>
<td>bar</td>
</tr>
<tr>
<td>Systemenv2</td>
<td>App test</td>
<td>bar</td>
</tr>
<tr>
<td rowSpan="2">System Memory</td>
<td rowSpan="2">Memory test</td>
<td>memory func</td>
<td>foo</td>
</tr>
<tr>
<td>Memory Func</td>
<td>foo</td>
</tr>
</table>

Get tr having specific th value from the table having an id using Xpath

I am using python3.6 with XPath library. Crawling inside the table gives me an empty list. And need to crawl to specific th.
My tr contents are dynamically generated. I need to crawl to tr which has a specific th value. Example In HTML code, the Rank appears in the second tr but it can appear in anywhere in tr. It doesn't have a specific index. Need to get the href from the tr having the Rank th.
My html file:
<tbody>
<tr>
<th class="a-color-secondary a-size-base prodDetSectionEntry">
Product Number
</th>
<td class="a-size-base">
B003NR57BY
</td>
</tr>
<tr>
<th class="a-color-secondary a-size-base prodDetSectionEntry">
Rank
</th>
<td>
<span>
<span>#3 in Computer Mice</span>
<br>
</span>
</td>
</tr>
<tr>
<th class="a-color-secondary a-size-base prodDetSectionEntry">
Created Date
</th>
<td class="a-size-base">
June 7, 2010
</td>
</tr>
</tbody>
</table>
Python code:
listings_details = parser.xpath(XPATH_PRODUCT_DETAILS)
for row in listings_details:
th = row.xpath("./th/text()")
if th[0].strip() == 'Rank':
categories = row.xpath("./td/span/span//text()")
qid_url= row.xpath("./td/span/span//#href")
I expect the output to be
Rank: 3,
url : /gp/bestsellers/pc/11036491/ref=pd_zg_hrsr_pc_1_1_last,
category: Computer Mice
Need to get the href from the tr having the Rank th.
Use:
/table/tbody/tr[normalize-space(th)='Rank']/td//a/#href
Note: this works for your provided fragment (now well-formed). You need to add later a context for selecting the table element.
<table>
<tbody>
<tr>
<th class="a-color-secondary a-size-base prodDetSectionEntry">Product Number</th>
<td class="a-size-base">B003NR57BY</td>
</tr>
<tr>
<th class="a-color-secondary a-size-base prodDetSectionEntry">Rank</th>
<td>
<span>
<span>#3 in
Computer Mice
</span>
<br/>
</span>
</td>
</tr>
<tr>
<th class="a-color-secondary a-size-base prodDetSectionEntry">Created Date</th>
<td class="a-size-base">June 7, 2010</td>
</tr>
</tbody>
</table>
Test in http://www.xpathtester.com/xpath/53808ee94dfbc5b38f12791cf857ffb9

In Excel How to copy column headers

In Excel how to copy column headers for all the rows which have a Yes against them and show them as comma separated values at the end of the row. For eg: as in the answer column below:
<table width="652">
<tbody>
<tr>
<td width="64"> </td>
<td width="64">petrol</td>
<td width="64">diesel</td>
<td width="64">oil</td>
<td width="64">screw</td>
<td width="64">nut</td>
<td width="64">bolt</td>
<td width="64">engine</td>
<td width="140">Answer</td>
</tr>
<tr>
<td>car</td>
<td>Yes</td>
<td> </td>
<td>Yes</td>
<td>Yes</td>
<td> </td>
<td> </td>
<td>Yes</td>
<td>Petrol,oil,screw,engine</td>
</tr>
<tr>
<td>bus</td>
<td>Yes</td>
<td> </td>
<td>Yes</td>
<td> </td>
<td> </td>
<td> </td>
<td>Yes</td>
<td>Petrol,oil,engine</td>
</tr>
<tr>
<td>bike</td>
<td> </td>
<td>Yes</td>
<td>Yes</td>
<td> </td>
<td>Yes</td>
<td> </td>
<td> </td>
<td>Diesel,oil,nut</td>
</tr>
<tr>
<td>scooter</td>
<td> </td>
<td>Yes</td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td>Diesel</td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</tbody>
</table>

many pandas dataframe to in one readeable file

a=np.array([[1,1,1,1],[2,2,2,2],[3,3,3,3]])
df=pandas.DataFrame(a)
df.to_html('table.html')
I am trying to make pandas.DataFrame to html.
The data are from csv.file, and i split it to several table.
i want make table are in one file one by one.(it's not linked together)
open(filename, mode):
it likes file open with mode 'a',no overwrite original file.
Sample output table like this.
How can i do that or are there another more readable way ?
You can proceed as follows:
put all your dataframes in a list
iterate through them and convert each one to HTML
concatenate all the HTML outputs to one single file
In terms of code, here's how you can do that:
a=np.array([[1,1,1,1],[2,2,2,2],[3,3,3,3]])
b=np.array([[1,4,5,1],[12,2,32,2],[3,32,30,3]])
df_a = pd.DataFrame(a)
df_b = pd.DataFrame(b)
list_df = [df_a, df_b]
output = ""
for index, df in enumerate(list_df):
output += df.to_html() + '<br>'
with open('output.html', 'w') as f:
f.writelines(output)
Here's how the ouput looks like:
<table border="1" class="dataframe">
<thead>
<tr style="text-align: right;">
<th></th>
<th>0</th>
<th>1</th>
<th>2</th>
<th>3</th>
</tr>
</thead>
<tbody>
<tr>
<th>0</th>
<td>1</td>
<td>1</td>
<td>1</td>
<td>1</td>
</tr>
<tr>
<th>1</th>
<td>2</td>
<td>2</td>
<td>2</td>
<td>2</td>
</tr>
<tr>
<th>2</th>
<td>3</td>
<td>3</td>
<td>3</td>
<td>3</td>
</tr>
</tbody>
</table><br><table border="1" class="dataframe">
<thead>
<tr style="text-align: right;">
<th></th>
<th>0</th>
<th>1</th>
<th>2</th>
<th>3</th>
</tr>
</thead>
<tbody>
<tr>
<th>0</th>
<td>1</td>
<td>4</td>
<td>5</td>
<td>1</td>
</tr>
<tr>
<th>1</th>
<td>12</td>
<td>2</td>
<td>32</td>
<td>2</td>
</tr>
<tr>
<th>2</th>
<td>3</td>
<td>32</td>
<td>30</td>
<td>3</td>
</tr>
</tbody>
</table><br>

Resources