Is is possible to delete a table in a worksheet with epplus? - epplus

In Epplus Worksheets have the member ExcelTableCollection Tables for adding and editing tables. However, you cannot delete a table. Is there another way to do it?

WorkSheet.Tables.Delete() is now implemented.

Related

Moving data from one Excel workboook to another, by matching common column fields as primary key in both workbooks

I Have two excel workbooks with many sheets, one of the workbooks is to map the data (all the keys and data structures we use) and the other workbook is a data dictionary to get the DataFeed key which is what need to populate in the first workbook. both workbooks have a common attribute (SNL key) in all the sheets in the workbooks but they aren't on the same sheets. Can I set up a primary key (SNL key) to join the workbooks together and populate the empty DataFeed key in the first workbook. at the moment im going through it one by one and there has to be a more efficient way of doing this.
Try VLOOKUP. It's possible to use across files although I recommend copying one sheet into the other workbook so that you don't have to deal with the linkages that creates. The key is that the shared primary key has to be the first column in the lookup table.
Microsoft also recently introduced XLOOKUP which is a little more flexible and should allow you to do the same thing.
Seems like it's probably overkill here but you could also use Power Query with both tables as data sources and then create a merge using a SQL-like join (Data tab -> Get Data -> Combine Queries -> Merge).

On delete cascade with 2 different tables

I have the following case, what I would like to do is, if I delete a row from DashboardKpi or DashboardGrid, the corresponding record on ComponentProperty should be deleted as well.
Is this possible? So far, I was only able to do the other way around, if I delete a ComponentProperty, the corresponding DashboardKpi or DashboardGrid gets deleted, but this is definitely not what I want.
ER Diagram
Any suggestion on how can I do?
Delete cascade wont help you. As you mentioned when you delete row cascade it will delete all other rows in other tables those referencing to original deleting row, after that your original row.
The reason of logic is that rows in ComponentProperty can be without DashboardKpi or DashboardGrid, but rows in DashboardKpi or DashboardGrid (if they have reference to ComponentProperty) cant not cause they depend on ComponentProperty.
You could solve your problem in different ways depending on your DBMS. Common to most of them is to use procedures or triggers. If you use Postgresql then you can use ON DELETE rule as well.

Count Customers in a column

I have a table that has 1K rows. In the table there is a column that has the names of the customers. I need to add a column that counts (index) how many customers I have.
Doing a calculated measure using the distinctcount formula I get 3156 customers. My goal is to accomplish the same result of the calculated field in a calculated column.
Thanks for the help.
Not sure about a calculated column but one way you can accomplish this is to make related dCustomers dimension table from your source. You question didn't happen to mention your source - here is how I'd do it for the most common sources in my estimation:
SQL database connection:
SELECT DISTINCT customerField
FROM yourViewOrTable
Excel/Text File:
Duplicate the worksheet with the Linked Table.
On the worksheet copy delete all columns except the Customers column.
With the a single cell active in the data go to Data>Remove Duplicates.
Under the PowerPivot ribbon tab click Create Linked Table.
Now What?
You should now have two tables from whatever source you are using. You'll find your new table has 3156 records in it. Go to Diagram view and drag a relationship from table1.CustomerField to table2.CustomerField.
With the relationship made you should be able to do anything you need to do, but please fire back if you have any questions on your use case.

Two way connection between excel and access

My requirement is there are multiple copies of same excel sheet with multiple users who update a table in the excel sheet.Then there is an access database where one of the tables get updated from the excel table updated by multiple users and also the change done by any one of the users in their excel sheet should also reflect in all the other users excel sheet. The users don't have access to the access database. I am working in 2007 version.
What I need to do is
1.connect all the excel copies to the access database.So if there's any change done by any of the user it gets updated in the access database.
2.Now the change that has been done by one of the user in the excel sheet should also reflect in the excel sheet of all the other users.
I tried solving this by linking the excel files to the access database which created many linked tables in access. So, this way the change in one of the excel file was reflecting in its respective linked table created in access.Then I joined all the linked tables to one table(say joined table) by using union query. Then I connected this joined table to the multiple excel sheet.When the user opens or refreshes the excel sheet, the table in the excel sheet gets updated.
But the problem that I am facing now is when there's some change done in one of the records in excel file instead of overwriting that record in the joined table it creating another record.So, now there are two records one record without the updated data and another with the updated data in the joined table and these two records are reflecting back in the table excel sheet as well. So say if I have 50 records in each of the linked file then there are 51 records getting created in the joined table in access database as well as in the excel table.
Can you please help me solve this as I have tried lot but I am unable to solve this.

Sql Serve - Cascade delete has multiple paths

I have two tables, Results and ComparedResults.
ComparedResults has two columns which reference the primary key of the Results table.
My problem is that if a record in Results is deleted, I wish to delete all records in ComparedResults which reference the deleted record, regardless of whether it's one column or the other (and the columns may reference the same Results row).
A row in Results may deleted directly or through cascade delete caused by deleting in a third table.
Googling this could indicate that I need to disable cascade delete and rewrite all cascade deletes to use triggers instead. Is that REALLY nessesary? I'd be prepared to do much restructuring of the database to avoid this, as my main area is OO programming, and databases should 'just work'. It is hard to see, however, how a restructuring could help as I would just move the problem around... Or am I missing something?
I am also a bit at a loss as to why my initial construct should even be a problem for the Sql Server?!
Any comments welcome and much appreciated!
Anders, Denmark
Would it be possible to split the ComparedResults into two tables?
Edit:
You could then use a View to gather the results for showing? Or a join between the two tables?