Merging two spreadsheets using a script and creating HTML language - excel

I have to merge this two stylesheet - http://www.j-e.com/Demo_Database.xlsx
The first one "DB" is a database of products, is a music shop.
As you can see I have four columns: the id of the product, the title, the price, and the tracklist.
Title and price are OK, but the column of the tracklist for now is empty.
The second one "TRACKS" is where my tracks are. Tree columns, the first one is the id of the produt who refer, the second column is the number of the track, and the third column is the title.
I need to merge all the tracks on different lines for each product from "TRACKS" in a single cell of the tracklist in "DB"
The real BESTBESTBEST is to have a structure like this in the cell tracklist of "DB" :
<table>
<tbody>
<tr>
<td>1.</td>
<td>TITLE_1</td>
</tr>
<tr>
<td>2.</td>
<td>TITLE_2</td>
</tr>
<tr>
<td>3.</td>
<td>TITLE_3</td>
</tr>
</tbody>

the question is
solved here:
http://www.vbaexpress.com/forum/showthread.php?54574-Merging-two-spreadsheets-using-a-script-and-creating-html-language
Thanks

Related

Compare two columns, if a value is missing in one of them add to it[Excel]

I have two columns of two different tables that I want to compare (same worksheet)
I have column "A" [which belongs to a master table] where I have Owners names for different projects.
Then I have column "D" [which belongs to a table that shows the number of project each owner has]
What I want to do is that every time I write new projects with their respective Owners in the first table, if the owner is not on the second table, Column "D", that the new name is added automatically to to this column "D".
Is that possible?
Edit:
Hi thank you for your replies
Here is a graphic example.
Table1&2
Table 1 (All tasks with their owner, manually entered)
<table><tr>
<th>Owner</th>
<th>Task</th>
</tr>
<tr>
<td>Mary</td>
<td>Task1</td>
</tr>
<tr>
<td>Mary</td>
<td>Task2</td>
</tr>
<tr>
<td>Patrick</td>
<td>Task3</td>
</tr>
<tr>
<td>John</td>
<td>Task</td></tr></table>
Table 2 (all the Owners)
<table><tr>
<th>Owner</th>
<th>Overdue Tasks</th>
</tr>
<tr>
<td>Mary</td>
<td>2</td>
</tr>
<tr>
<td>John</td>
<td>1</td>
</tr>
<tr>
<td>Patrick</td>
<td>1</td>
</tr>
<tr>
</table>
So what I want is if I add new tasks in table 1 and they have an owner that is not yet in table 2, that the name of this new Owner is automatically updated in the table 2.
What If tried so far was to add a new column with =NOT(ISNUMBER(MATCH(H2,$P$2:$P$46,0)))
to check if the name is in table 2
and then tried with =IF($L2="TRUE",SUM($H2)," ") in the second table.
But I think thats a paradox and won't work
Also tried =IFERROR(VLOOKUP($H2,$P2:$P145,COLUMN(H2),FALSE),"")
But doesn't work either

Get html data in post method in netsuite suitelet

I have a suitelet in which in run html code having an html table. I have given checkbox to the table. I wanted to retrieve number of lines and values in table which are checked after I click Submit on Suitelet. However, I only get one value of checkbox and not how many lines I have set the checkbox true.
<table>
<tbody>
<tr>
<td>
<input type="checkbox" class="select-items" name="selectitem" id="selectitem">
</td>
</tr>
<tbody>
<table>

Parsing html tables with Beautifulsoup in Python

I'm trying to parse tables from lots of html pages. Each tagret table has next structure:
<table width="100%%" border="2" bordercolor="navy">
<tr bordercolor="#0000FF">
<td width="20%%" height="22" bgcolor="navy"><font color="#FFFFFF"><b>Field1</b></font></td>
<td width="20%%" height="22" bgcolor="navy"><font color="#FFFFFF"><b>Field2</b></font></td>
<td width="60%%" height="22" bgcolor="navy"><font color="#FFFFFF"><b>Field3</b></font></td>
</tr>
<tr>
<td width="12%">A1</td>
<td width="32%">A2</td>
<td width="56%">A3</td>
</tr>
<tr>
<td width="12%">B1</td>
<td width="32%">B2</td>
<td width="56%">B3
</td>
</tr>
<tr>
<td width="12%">C1</td>
<td width="32%">C2</td>
<td width="56%">C3</td>
</tr>
<tr>
<td width="12%">D1</td>
<td width="32%">D2</td>
<td width="56%">D3</td>
</tr>
</table>
Number of rows varies from page to page, so parser should be able to work for any number of rows. I would like to collect info from each html page like
A1 A2 A3
B1 B2 B3
C1 C2 C3
D1 D2 D3
How can I do that?
You can use find_all() and get_text() to gather the table data. The find_all() method returns a list that contains all descendants of a tag; and get_text() returns a string that contains a tag's text contents. First select all tabes, for each table select all rows, for each row select all columns and finally extract the text. That would collect all table data in the same order and structure that it appears on the HTML document.
from bs4 import BeautifulSoup
html = 'my html document'
soup = BeautifulSoup(html, 'html.parser')
tables = [
[
[td.get_text(strip=True) for td in tr.find_all('td')]
for tr in table.find_all('tr')
]
for table in soup.find_all('table')
]
The tables variable contains all the tables in the document, and it is a nested list that has the following structure,
tables -> rows -> columns
If the structure is not important and you only want to collect text from all tables in one big list, use:
table_data = [i.text for i in soup.find_all('td')]
Or if you prefer CSS selectors:
table_data = [i.text for i in soup.select('td')]
If the goal is to gather table data regardless of HTML attributes or other parameters, then it may be best to use pandas. The pandas.read_html() method reads HTML from URLs, files or strings, parses it and returns a list of dataframes that contain the table data.
import pandas as pd
html = 'my html document'
tables = pd.read_html(html)
Note that pandas.read_html() is more fragile than BeautifulSoup and it will raise a Value Error if it fails to parse the HTML or if the document doesn't have any tables.

not able to paginate using struts

<table id="example1" class="cell-border" cellspacing="0" width="100%">
<thead>
<tr>
<th>Entry Page Name</th>
<th>Visits</th>
<th>Bounce</th>
</tr>
</thead>
<tbody>
<s:iterator value="table" var="dashboardTable">
<tr>
<td><s:property value="actionName" /></td>
<td><s:property value="count" /></td>
<td><s:property value="sum" /></td>
</tr>
</s:iterator>
</tbody>
</table>
This is my code.
(Struts) I want to paginate my data in table for each 10 rows. Please can anyone help?
You seem to be populating data in a table , pagination in any grid has these following steps
I'm going to explain a simple but not so elegant method .
let's say you have 100 records , and you wish to display 10 records / page
In the grid (Table and other elements) you put a dropdown , which has 1-10 page numbers (since you have 100 records / 10 records per page) , which you can get by doing a select count(*).
1.Initially you display limited data , by executing a sql select with limit clause , say you display 10 records initially .
EX : select * from patient limit 1,10 - get first 10 records
2.Next user wishes to get patients from 5th page , hence he selects '5' from drop down and clicks "fetch" , backend you need to multiply 5 * 10 (records you wish to display per page" now you execute following sql query
EX : select * from patient limit 51,60
now the records from 51 - 60 are fetched and displayed
this a simple and easy pagination which doesn't involve jquery or any javascript , you can modify it by removing page no dropdown and putting it for display in a linear fashion by using many libraries .
Hope it helps.

How to make datatable headers span a number of columns

I have a simple JSF datatable, which currently has four columns, one header row and (with current data) three data rows.
I have to add three extra columns; that part's easy.
I also want to add another header row before the existing header row with headers that span a subset of the columns.
The desired result is something like:
Column 1: first row empty; header on second row.
Columns 2-4: first row header spans 3 columns; second row has individual column headers.
Columns 5-7: first row header spans 3 columns; second row has individual column headers.
Is this possible? If so, how do I do it?
Following are images showing what it should look like.
This is the data table before I've changed anything.
Table Example 1 http://www.isw.com.au/home/sjleis/stuff.nsf/tableexample1.gif
This is the data table after I've added three columns. I was able to do this easily.
Table Example 1 http://www.isw.com.au/home/sjleis/stuff.nsf/tableexample2.gif
This shows the desired end result, which I can't figure out. Note the "Retail Sales" and "Fleet/Gov Sales" headers each span three columns.
Table Example 1 http://www.isw.com.au/home/sjleis/stuff.nsf/tableexample3.gif
This would be easy if you were using Richfaces (as Bozho mentions) with the breakBefore attribute.
Here's a quick example:
<rich:dataTable value="#{countryCodeListFactory}" var="c">
<f:facet name="header">
<rich:columnGroup>
<rich:column colspan="2">Main</rich:column>
<rich:column colspan="4">Other Details</rich:column>
<rich:column breakBefore="true">Country ID</rich:column>
<rich:column>Name</rich:column>
<rich:column>Region</rich:column>
<rich:column>Alpha</rich:column>
<rich:column>ISO</rich:column>
<rich:column>Flag Path</rich:column>
</rich:columnGroup>
</f:facet>
<rich:column>#{c.countryId}</rich:column>
<rich:column>#{c.countryName}</rich:column>
<rich:column>#{c.region}</rich:column>
<rich:column>#{c.alpha3}</rich:column>
<rich:column>#{c.isoNum}</rich:column>
<rich:column>#{c.flagImage}</rich:column>
</rich:dataTable>
If you're not then hopefully you're using facelets. Then you can build the table manually using the <ui:repeat>
<table>
<tr>
<th colspan="2">Main</th>
<th colspan="4">Details</th>
</tr>
<tr>
<th>ID</th>
<th>Name</th>
<th>Region</th>
<th>Alpha</th>
<th>ISO</th>
<th>Flag</th>
</tr>
<ui:repeat value="#{countryCodeListFactory}" var="c">
<tr>
<td>#{c.countryId}</td>
<td>#{c.countryName}</td>
<td>#{c.region}</td>
<td>#{c.alpha3}</td>
<td>#{c.isoNum}</td>
<td>#{c.flagImage}</td>
</tr>
</ui:repeat>
</table>
You can't do this with <h:dataTable>. Well, you can with some ugly hacks, like modifying the DOM with javascript and adding the desired columns, but that's not what you should do.
Take a look at RichFaces dataTable - its columns support the colspan attribute.

Resources