{"text_format":"1","workbook":"xlsx","n_sheets":10,"sheets":["menu","menulog","docs.@tutorials","docs.params","docs.products","docs.Sales__E","docs_invoices","docs_payments","GL","Sales"],"not_rendered":{"charts":0,"images":0,"macros":1,"external_links":0,"defined_names":1,"comments":0,"pivot_tables":0},"unopened":[],"bounds":{"document_bytes":16777216,"sheet_cells":100000,"rows_first":2000,"rows_last":500,"rows_between":2000,"halvings":0,"cell_chars":16384,"cell_head_chars":4096},"cells_cut":0,"cells_raw":0,"read":"whole","date_system":"1900"}

{"sheet":"menu","index":0,"n_rows":4,"n_cols":10,"rows_kept":4,"cut":false,"hidden":false,"merged":[]}
["MENU LIST ","Build Date 29/08/2025 11:20:57 PM","aelinon@caratrel.com","userkey1"]
["SQL","A (SQL Versions)","B","C","D","E","F","G","H","I"]
["GL","GL Bals CY","GL Bals BRANCH CY","GL Bals SYD CY","GL Bals any year","GL Bals User CY","GL Txns CY","GL Bals SYD CY.02","Title Sample ODBC","Update ODBC GL"]
["Sales","Tutorial #1_Using Python Sheets - Report 1","Tutorial #1_Using Python Sheets - Report 2","Tutorial #2_Using ODBC CSV R01","Tutorial #2_Using ODBC CSV R02","Tutorial #3_Using Python CSV payments","Tutorial #3_Using Python CSV invoices","Tutorial #3_Using Python Sheets - Report 1"]

{"sheet":"menulog","index":1,"n_rows":5,"n_cols":1,"rows_kept":5,"cut":false,"hidden":false,"merged":[]}
["Log Message"]
["1/10/2025 9:30:20 PM: Temporary directory set to: c:\\temp\\d4e\\"]
["1/10/2025 9:30:41 PM: Internal Store cleared. Please open or add an SQL file."]
["1/10/2025 9:30:41 PM: Temporary directory set to: c:\\temp\\d4e\\"]
["1/10/2025 10:21:46 PM: Temporary directory set to: c:\\temp\\d4e\\"]

{"sheet":"docs.@tutorials","index":2,"n_rows":36,"n_cols":3,"rows_kept":36,"cut":false,"hidden":false,"merged":[]}
["TUTORIAL #1","TUTORIAL #2","TUTORIAL #3"]
["Tutorial: Run SQL using Python and Tab Sheets as Data Source","Tutorial: Run SQL using CSV files and ODBC","Tutorial: Run SQL using CSV files and Python"]
[]
["Preparation - if not done yet","Preparation - if not done yet","Preparation - if not done yet"]
[]
["1. Open your D4E workbook.","1. Create a folder: C:\\Temp\\D4E\\","1. Create a folder: C:\\Temp\\D4E\\"]
[]
["2. Make sure the sheets docs_invoices and docs_payments are present and visible.","2. In your D4E workbook, go to the sheet docs_invoices.","2. In your D4E workbook, go to the sheet docs_invoices."]
[]
["docs_invoices contains your invoice rows.","Right-click the sheet tab → Move or Copy… → (new book) → OK.","Right-click the sheet tab → Move or Copy… → (new book) → OK."]
[]
["docs_payments contains your payment rows.","In the new workbook: File → Save As → choose CSV (Comma delimited) (*.csv).","In the new workbook: File → Save As → choose CSV (Comma delimited) (*.csv)."]
[]
["3. No need to copy or save as CSV — the SQL engine will read directly from the active workbook.","Save as C:\\Temp\\D4E\\docs_invoices.csv.","Save as C:\\Temp\\D4E\\docs_invoices.csv."]
[]
["Running","3. Back in the D4E workbook, go to docs_payments.","3. Back in the D4E workbook, go to docs_payments."]
[]
["1. Go to the Excel ribbon: Add-ins → My Tools → Get Menu."]
[]
["2. Then select: Add-ins → Run SQL Versions → Sales → Tutorial #1_Using Python Sheets - Report 1","Right-click the sheet tab → Move or Copy… → (new book) → OK.","Right-click the sheet tab → Move or Copy… → (new book) → OK."]
["3. Then select: Add-ins → Run SQL Versions → Sales → Tutorial #1_Using Python Sheets - Report 2"]
["This will run the SQL against the two workbook sheets (docs.invoices, docs.payments) using the dbms=Sheets driver and produce the reconciliation results.","File → Save As → CSV (Comma delimited) (*.csv).","File → Save As → CSV (Comma delimited) (*.csv)."]
[]
["4. To clean up output sheets: Add-ins > My Tools > Remove Sheets","Save as C:\\Temp\\D4E\\docs_payments.csv.","Save as C:\\Temp\\D4E\\docs_payments.csv."]
[]
[null,"Tip: If prompted about features not compatible with CSV, choose Yes to keep using this format.","Tip: If prompted about features not compatible with CSV, choose Yes to keep using this format."]
[]
[null,"Running","Running"]
[]
[null,"1. Excel ribbon: Add-ins → My Tools → Get Menu.","1. Excel ribbon: Add-ins → My Tools → Get Menu."]
[]
[null,"2. Excel ribbon: Add-ins → Run SQL Versions → Sales → Tutorial #2_Using ODBC CSV R01","2. Excel ribbon: Add-ins → Run SQL Versions → Sales → Tutorial #3_Using Python CSV payments"]
[null,"3. Excel ribbon: Add-ins → Run SQL Versions → Sales → Tutorial #2_Using ODBC CSV R02","3. Excel ribbon: Add-ins → Run SQL Versions → Sales → Tutorial #3_Using Python CSV invoices"]
[null,"That’s it—the SQL will read C:\\Temp\\D4E\\invoices.csv and C:\\Temp\\D4E\\payments.csv and produce the reconciliation output.","4. Excel ribbon: Add-ins → Run SQL Versions → Sales → Tutorial #3_Using Python Sheets - Report 1"]
[null,null,"The first 2 reports will create 2 sheets in the workbook.  The 3rd report will read these output sheets, and create a summary."]
[null,null,"This demonstrates that you can read data from different source dbms and collate the information using SQL"]

{"sheet":"docs.params","index":3,"n_rows":7,"n_cols":1,"rows_kept":7,"cut":false,"hidden":false,"merged":[]}
["Sydney"]
["Perth"]
["Adelaide"]
["###1B11020D1B4C011B0B1D63612B243B3A###"]
[30]
["root"]
["password"]

{"sheet":"docs.products","index":4,"n_rows":101,"n_cols":6,"rows_kept":101,"cut":false,"hidden":false,"merged":[]}
["RecID","Name","Age","City","Product_Name","Sales_Amount"]
[1,"Arthur Hill",24,"Adelaide","Headset",251.92]
[2,"Matthew Pitts",41,"Melbourne","Office Chair",943.82]
[3,"Katherine Brady",55,"Sydney","Coffee Mug",994.07]
[4,"April Thomas",42,"Adelaide","Monitor",600.86]
[5,"Christina Wood",36,"Adelaide","Wireless Mouse",139.82]
[6,"Matthew Pitts",45,"Perth","Office Chair",910.14]
[7,"Jimmy Hart",30,"Perth","USB Drive",117.03]
[8,"Tyrone Wall",59,"Brisbane","Headset",772.58]
[9,"Nicholas Stewart",37,"Perth","Running Shoes",573.58000000000004]
[10,"James Chavez",58,"Sydney","Sneakers",252.87]
[11,"Arthur Hill",29,"Adelaide","Laptop",666.92]
[12,"Linda Joseph MD",41,"Perth","Leather Bag",311.23]
[13,"Sandra Bowman MD",18,"Perth","Mechanical Keyboard",785.45]
[14,"Arthur Hill",40,"Perth","Office Chair",596.03]
[15,"Sandra Bowman MD",51,"Adelaide","Water Bottle",174.55]
[16,"April Thomas",22,"Brisbane","Desk Lamp",934.18]
[17,"Samantha Bonilla",65,"Brisbane","Mechanical Keyboard",841.61]
[18,"Linda Joseph MD",54,"Sydney","Office Chair",362.71]
[19,"Jimmy Hart",47,"Sydney","Mechanical Keyboard",664.55]
[20,"William Adkins",46,"Perth","Desk Lamp",948.86]
[21,"Linda Joseph MD",34,"Adelaide","Running Shoes",216.89]
[22,"James Chavez",53,"Sydney","Gel Pen",787.59]
[23,"Tyrone Wall",63,"Sydney","Desk Lamp",311.27999999999997]
[24,"Kevin Osborne",53,"Sydney","Headset",498.74]
[25,"Tyrone Wall",39,"Brisbane","Ballpoint Pen",913.47]
[26,"Christina Wood",53,"Adelaide","Planner",779.29]
[27,"Samantha Bonilla",20,"Perth","Textbook",761.08]
[28,"Christina Wood",42,"Brisbane","Desk Lamp",926.27]
[29,"Katherine Brady",21,"Brisbane","Water Bottle",154.81]
[30,"Samantha Bonilla",38,"Melbourne","Sneakers",977.99]
[31,"William Adkins",41,"Brisbane","Water Bottle",281.97000000000003]
[32,"Kevin Osborne",44,"Perth","Coffee Mug",956.18]
[33,"Samantha Bonilla",40,"Adelaide","Sneakers",219.86]
[34,"Nicholas Stewart",42,"Perth","Mechanical Keyboard",161.15]
[35,"Arthur Hill",49,"Adelaide","Headset",676.81]
[36,"Linda Joseph MD",43,"Brisbane","Running Shoes",438.63]
[37,"Matthew Pitts",47,"Perth","Monitor",325.8]
[38,"Sandra Bowman MD",62,"Brisbane","Ballpoint Pen",617.54]
[39,"Nicholas Stewart",38,"Brisbane","USB Drive",811.08]
[40,"William Adkins",35,"Sydney","Desk Lamp",290.12]
[41,"Linda Joseph MD",18,"Melbourne","Ballpoint Pen",318.39]
[42,"Katherine Brady",56,"Brisbane","Planner",955.75]
[43,"Nicholas Stewart",63,"Perth","Gel Pen",475.41]
[44,"Jimmy Hart",21,"Adelaide","Desk Lamp",785.52]
[45,"Nicholas Stewart",34,"Melbourne","USB Drive",448.8]
[46,"Matthew Pitts",55,"Brisbane","Running Shoes",892.69]
[47,"Allen Thompson",59,"Perth","Running Shoes",307.45999999999998]
[48,"Matthew Pitts",49,"Perth","USB Drive",124.59]
[49,"Nicholas Stewart",34,"Melbourne","Coffee Mug",165.43]
[50,"James Chavez",47,"Perth","Laptop",442.52]
[51,"Allen Thompson",52,"Melbourne","Laptop",901.48]
[52,"April Thomas",41,"Perth","Notebook",541.14]
[53,"Kevin Osborne",58,"Sydney","Running Shoes",523.44000000000005]
[54,"Tyrone Wall",57,"Melbourne","Leather Bag",965.56]
[55,"Matthew Pitts",19,"Perth","Textbook",572.09]
[56,"April Thomas",41,"Perth","Sneakers",173.79]
[57,"Linda Joseph MD",63,"Sydney","Coffee Mug",377.33]
[58,"Kevin Osborne",60,"Brisbane","Sneakers",382.81]
[59,"Nicholas Stewart",23,"Melbourne","Ballpoint Pen",957.44]
[60,"Arthur Hill",60,"Adelaide","Planner",658.57]
[61,"Arthur Hill",53,"Sydney","Leather Bag",776.04]
[62,"Arthur Hill",30,"Perth","Headset",140.72999999999999]
[63,"William Adkins",51,"Sydney","Textbook",112.05]
[64,"Tyrone Wall",42,"Adelaide","Water Bottle",697.21]
[65,"Matthew Pitts",64,"Brisbane","Mechanical Keyboard",267.31]
[66,"Allen Thompson",32,"Brisbane","Running Shoes",698.93]
[67,"April Thomas",21,"Melbourne","Study Table",912.37]
[68,"Katherine Brady",60,"Brisbane","Headset",906.31]
[69,"Nicholas Stewart",18,"Melbourne","Leather Bag",331.91]
[70,"Arthur Hill",39,"Adelaide","Leather Bag",698.62]
[71,"Sandra Bowman MD",46,"Brisbane","Notebook",684.8]
[72,"Nicholas Stewart",27,"Perth","Leather Bag",406]
[73,"Katherine Brady",35,"Brisbane","Leather Bag",391.39]
[74,"Sandra Bowman MD",50,"Sydney","Leather Bag",825.31]
[75,"Sandra Bowman MD",27,"Adelaide","Office Chair",550.49]
[76,"Nicholas Stewart",24,"Perth","Planner",877.57]
[77,"Samantha Bonilla",56,"Sydney","Sneakers",876.47]
[78,"Jimmy Hart",63,"Sydney","Leather Bag",982.61]
[79,"William Adkins",61,"Brisbane","Desk Lamp",275.77]
[80,"James Chavez",43,"Perth","Notebook",328.59]
[81,"Matthew Pitts",35,"Melbourne","Mechanical Keyboard",825.84]
[82,"Linda Joseph MD",52,"Brisbane","Study Table",121.59]
[83,"Christina Wood",57,"Perth","Water Bottle",682.93]
[84,"Katherine Brady",34,"Melbourne","Coffee Mug",401.15]
[85,"Allen Thompson",44,"Adelaide","Mechanical Keyboard",736.71]
[86,"William Adkins",59,"Brisbane","Coffee Mug",734.59]
[87,"James Chavez",63,"Sydney","Desk Lamp",744.08]
[88,"Jimmy Hart",65,"Perth","Running Shoes",863.68]
[89,"Linda Joseph MD",53,"Melbourne","USB Drive",149.79]
[90,"Linda Joseph MD",54,"Adelaide","Running Shoes",362.47]
[91,"Samantha Bonilla",65,"Perth","Coffee Mug",200]
[92,"Matthew Pitts",21,"Adelaide","Leather Bag",361.73]
[93,"Katherine Brady",22,"Melbourne","Leather Bag",153.66]
[94,"April Thomas",23,"Perth","Planner",317.81]
[95,"Matthew Pitts",41,"Sydney","Ballpoint Pen",649.41999999999996]
[96,"Sandra Bowman MD",27,"Brisbane","Mechanical Keyboard",101.53]
[97,"April Thomas",23,"Melbourne","Planner",994.72]
[98,"William Adkins",28,"Sydney","Headset",871.05]
[99,"Samantha Bonilla",32,"Brisbane","Sneakers",812.19]
[100,"April Thomas",22,"Adelaide","Headset",339.13]

{"sheet":"docs.Sales__E","index":5,"n_rows":21,"n_cols":4,"rows_kept":21,"cut":false,"hidden":true,"merged":[]}
["PaymentID","Customer","PaymentDate","Amount"]
[101,"ACME","2025-07-06",100]
[102,"ACME","2025-07-20",150]
[103,"BetaCorp","2025-07-07",200]
[104,"BetaCorp","2025-07-21",150]
[105,"Cyclone","2025-07-08",100]
[106,"Cyclone","2025-07-22",200]
[107,"Cyclone","2025-07-29",150]
[108,"DeltaWorks","2025-07-09",250]
[109,"DeltaWorks","2025-07-23",200]
[110,"EdgeLabs","2025-07-10",100]
[111,"EdgeLabs","2025-07-24",150]
[112,"EdgeLabs","2025-07-31",100]
[113,"FinServ","2025-07-11",150]
[114,"Goldline","2025-07-12",100]
[115,"Goldline","2025-07-26",200]
[116,"Helios","2025-07-13",200]
[117,"Helios","2025-07-27",150]
[118,"Helios","2025-08-03",250]
[119,"Helios","2025-08-10",100]
[120,"Helios","2025-08-17",200]

{"sheet":"docs_invoices","index":6,"n_rows":25,"n_cols":4,"rows_kept":25,"cut":false,"hidden":false,"merged":[]}
["InvoiceID","Customer","InvoiceDate","Amount"]
[1,"ACME","2025-07-01",100]
[2,"ACME","2025-07-08",200]
[3,"ACME","2025-07-15",150]
[4,"BetaCorp","2025-07-02",250]
[5,"BetaCorp","2025-07-09",300]
[6,"BetaCorp","2025-07-16",150]
[7,"Cyclone","2025-07-03",100]
[8,"Cyclone","2025-07-10",200]
[9,"Cyclone","2025-07-17",200]
[10,"DeltaWorks","2025-07-04",300]
[11,"DeltaWorks","2025-07-11",250]
[12,"DeltaWorks","2025-07-18",150]
[13,"EdgeLabs","2025-07-05",200]
[14,"EdgeLabs","2025-07-12",100]
[15,"EdgeLabs","2025-07-19",250]
[16,"FinServ","2025-07-06",150]
[17,"FinServ","2025-07-13",300]
[18,"Goldline","2025-07-07",200]
[19,"Goldline","2025-07-14",100]
[20,"Helios","2025-07-08",250]
[21,"Helios","2025-07-15",200]
[22,"Helios","2025-07-22",150]
[23,"Helios","2025-07-29",100]
[24,"Helios","2025-08-05",300]

{"sheet":"docs_payments","index":7,"n_rows":21,"n_cols":4,"rows_kept":21,"cut":false,"hidden":false,"merged":[]}
["PaymentID","Customer","PaymentDate","Amount"]
[101,"ACME","2025-07-06",100]
[102,"ACME","2025-07-20",150]
[103,"BetaCorp","2025-07-07",200]
[104,"BetaCorp","2025-07-21",150]
[105,"Cyclone","2025-07-08",100]
[106,"Cyclone","2025-07-22",200]
[107,"Cyclone","2025-07-29",150]
[108,"DeltaWorks","2025-07-09",250]
[109,"DeltaWorks","2025-07-23",200]
[110,"EdgeLabs","2025-07-10",100]
[111,"EdgeLabs","2025-07-24",150]
[112,"EdgeLabs","2025-07-31",100]
[113,"FinServ","2025-07-11",150]
[114,"Goldline","2025-07-12",100]
[115,"Goldline","2025-07-26",200]
[116,"Helios","2025-07-13",200]
[117,"Helios","2025-07-27",150]
[118,"Helios","2025-08-03",250]
[119,"Helios","2025-08-10",100]
[120,"Helios","2025-08-17",200]

{"sheet":"GL","index":8,"n_rows":35,"n_cols":13,"rows_kept":35,"cut":false,"hidden":false,"merged":[]}
["/* GL Bals CY */","/* GL Bals BRANCH CY */","/* GL Bals SYD CY */","/* GL Bals any year */","/* GL Bals User CY */","/* GL Txns CY */","/* GL Bals SYD CY.02 */","/* Title Sample ODBC */","/* Update ODBC GL */"]
["/* Driver: ","/* Driver: ","/* Driver: ","/* Driver: ","/* Driver: ","/* Driver: ","/* Driver: ","/* Driver:","/* Driver:"]
[]
["$type=Python,","$type=Python,","$type=Python,","$type=Python,","$type=Python,","$type=Python,","$type=Python,","$type=ODBC,","$type=ODBC,"]
["$dbms=CSV,","$dbms=CSV,","$dbms=CSV,","$dbms=CSV,","$dbms=CSV,","$dbms=CSV,","$dbms=CSV,",null,"$table=Budgets,"]
["$file_path=<<#td#>>gl_balances_data.csv,","$file_path=<<#td#>>gl_balances_data.csv,","$file_path=<<#td#>>gl_balances_data.csv,","$file_path=<<#td#>>gl_balances_data.csv,","$file_path=<<#td#>>gl_balances_data.csv,","$file_path=<<#td#>>gl_transactions_data.csv,","$file_path=<<#td#>>gl_balances_data.csv,","$conn=","$conn="]
["$results=keep,","$results=keep,","$results=keep,","$results=keep,","$results=keep,","$results=keep,","$results=keep,","Provider=Microsoft.ACE.OLEDB.12.0;","Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\temp\\d4e\\FinancialData.accdb;Persist Security Info=False;"]
["$showresults=yes,","$showresults=yes,","$showresults=yes,","$showresults=yes,","$showresults=yes,","$showresults=yes,","$showresults=yes,","Data Source=C:\\temp\\d4e\\FinancialData.accdb;","=$conn,"]
[null,null,null,null,null,null,null,"Persist Security Info=False;"]
[null,null,null,null,null,null,null,null,"*/"]
[null,null,null,null,null,null,null,"=$conn,"]
[null,null,null,null,null,null,null,null,"SELECT "]
["*/","*/","*/","*/","*/","*/","*/","*/","'U' as Action_Code,"]
[]
["SELECT * FROM data WHERE Year = 2025","SELECT * FROM data WHERE Year = 2025","SELECT * FROM data WHERE Year = 2025","SELECT * FROM data ","SELECT * FROM data ","SELECT * FROM data WHERE Year = 2025","SELECT ","SELECT * FROM Budgets","Budget_Code as Budget_Code_key,"]
[null,null,null,"WHERE 1=1","WHERE Year = 2025",null,null,null,"Company,"]
[null,null,null,"and  <<Choose YYYYMM$in$cast((Period+Year*100) as integer)?>>","and Branch IN (\"test\"",null,"Company as Company_key,",null,"Branch,"]
[{"$f":"\"and  <<Choose \" &$M18 &\"$in$\" & $M18 & \"?>> \"","v":"and  <<Choose Company$in$Company?>> "},"and Branch = '<<Choose Branch?>>'","and Branch IN ( ",{"$f":"\"and  <<Choose \" &$M18 &\"$in$\" & $M18 & \"?>> \"","v":"and  <<Choose Company$in$Company?>> "},"<<[[#td#]]userprofile1.txt@@1>>",{"$f":"\"and  <<Choose \" &$M18 &\"$in$\" & $M18 & \"?>> \"","v":"and  <<Choose Company$in$Company?>> "},"Branch as Branch_key,",null,"Account,",null,null,null,"Company"]
[{"$f":"\"and  <<Choose \" &$M19 &\"$in$\" & $M19 & \"?>> \"","v":"and  <<Choose Branch$in$Branch?>> "},null,"'<<c:\\temp\\d4e\\branch1.txt@@1>>',","and  <<Choose Branch$in$Branch?>> ","<<[[#td#]]userprofile2.txt@@1>>","and  <<Choose Branch$in$Branch?>> ","Account as Branch_key,",null,"Curr,",null,null,null,"Branch"]
["and  <<Choose Account$in$Account?>> ",null,"'<<c:\\temp\\d4e\\branch2.txt@@1>>',","and  <<Choose Account$in$Account?>> ","<<[[#td#]]userprofile3.txt@@1>>","and  <<Choose Account$in$Account?>> ","Premium_Class,",null,"Net_Amt",null,null,null,"Account"]
["and  <<Choose Premium_Class$in$Premium_Class?>> ",null," '')","and  <<Choose Premium_Class$in$Premium_Class?>> ","<<[[#td#]]userprofile4.txt@@1>>","and  <<Choose Premium_Class$in$Premium_Class?>> ","RI_CC,",null,null,null,null,null,"Premium_Class"]
["and  <<Choose RI_CC$in$RI_CC?>> ",null,null,"and  <<Choose RI_CC$in$RI_CC?>> ","<<[[#td#]]userprofile5.txt@@1>>","and  <<Choose RI_CC$in$RI_CC?>> ","Source_Employee,",null,null,null,null,null,"RI_CC"]
["and  <<Choose Source_Employee$in$Source_Employee?>> ",null,null,"and  <<Choose Source_Employee$in$Source_Employee?>> ","<<[[#td#]]userprofile6.txt@@1>>","and  <<Choose Source_Employee$in$Source_Employee?>> ","UW_Year,",null,"  ",null,null,null,"Source_Employee"]
["and  <<Choose UW_Year$in$UW_Year?>> ",null,null,"and  <<Choose UW_Year$in$UW_Year?>> ",", \"test\")","and  <<Choose UW_Year$in$UW_Year?>> ","Intercompany,",null,null,null,null,null,"UW_Year"]
["and  <<Choose Intercompany$in$Intercompany?>> ",null,null,"and  <<Choose Intercompany$in$Intercompany?>> "," /* this SQL example demonstrates how you can assign Windows access to files per user,so that only a particlar user will return a value to,e.g, userprofile1.txt, thus running same SQL will have different results based on different userids */","and  <<Choose Intercompany$in$Intercompany?>> ","Spare1,",null,null,null,null,null,"Intercompany"]
[null,null,null,null,null,null,"Spare2,"]
[null,null,null,null,null,null,"Currency,"]
[null,null,null,null,null,null,"DR,"]
[null,null,null,null,null,null,"CR,",null,"FROM Budgets"]
[null,null,null,null,null,null,"Net_Amt,"]
[null,null,null,null,null,null,"Year as Year_key,"]
[null,null,null,null,null,null,"Period as Period_key,"]
[null,null,null,null,null,null,"Account_Description"]
[]
[null,null,null,null,null,null,"FROM data WHERE Year = 2025"]

{"sheet":"Sales","index":9,"n_rows":58,"n_cols":7,"rows_kept":58,"cut":false,"hidden":false,"merged":[]}
["/* Tutorial #1_Using Python Sheets - Report 1 */","/* Tutorial #1_Using Python Sheets - Report 2 */","/* Tutorial #2_Using ODBC CSV R01 */","/* Tutorial #2_Using ODBC CSV R02 */","/* Tutorial #3_Using Python CSV payments */","/* Tutorial #3_Using Python CSV invoices */","/* Tutorial #3_Using Python Sheets - Report 1 */"]
["/* Driver: ","/* Driver:","/* Driver:","/* Driver:","/* Driver: ","/* Driver: ","/* Driver: "]
[null,"$type=Python,","$type=ODBC,","$type=ODBC,","$type=Python,","$type=Python,"]
["$type=Python,","$dbms=Sheets,",null,null,"$dbms=CSV,","$dbms=CSV,","$type=Python,"]
["$dbms=Sheets,",null,"$conn=Driver={Microsoft Access Text Driver (*.txt, *.csv)};Dbq=C:\\Temp\\D4E\\;Extensions=csv;=$conn,","$conn=Driver={Microsoft Access Text Driver (*.txt, *.csv)};Dbq=C:\\Temp\\D4E\\;Extensions=csv;=$conn,","$file_path=c:\\temp\\d4e\\docs_payments.csv,","$file_path=c:\\temp\\d4e\\docs_invoices.csv,","$dbms=Sheets,"]
[null,"*/"]
["*/",null,"*/","*/","*/","*/","*/"]
[" /* STEP 7: FULLER RECON (append payments-only customers) */","/* Safe: aggregate first, then join */","SELECT *","select * from [docs_payments.csv]","select * from data","select * from data"," /* STEP 7: FULLER RECON (append payments-only customers) */"]
["SELECT *","SELECT *","FROM (","union all",null,null,"SELECT *"]
["FROM (","FROM (","  SELECT","select * from [docs_invoices.csv]",null,null,"FROM ("]
["  /* invoices side */","  SELECT","    a.Customer,",null,null,null,"  /* invoices side */"]
["  SELECT","    a.Customer,","    a.Invoiced,",null,null,null,"  SELECT"]
["    a.Customer,","    a.Invoiced,","    IIF(p.Paid IS NULL, 0, p.Paid) AS Paid,",null,null,null,"    a.Customer,"]
["    a.Invoiced,","    COALESCE(p.Paid, 0) AS Paid,","    a.Invoiced - IIF(p.Paid IS NULL, 0, p.Paid) AS Variance,",null,null,null,"    a.Invoiced,"]
["    COALESCE(p.Paid, 0) AS Paid,","    a.Invoiced - COALESCE(p.Paid, 0) AS Variance,","    a.LastInvoiceDate,",null,null,null,"    COALESCE(p.Paid, 0) AS Paid,"]
["    a.Invoiced - COALESCE(p.Paid, 0) AS Variance","    a.LastInvoiceDate,","    p.LastPaymentDate",null,null,null,"    a.Invoiced - COALESCE(p.Paid, 0) AS Variance"]
["  FROM (","    p.LastPaymentDate","  FROM (",null,null,null,"  FROM ("]
["    SELECT Customer, SUM(CAST(Amount AS REAL)) AS Invoiced","  FROM (","    SELECT",null,null,null,"    SELECT Customer, SUM(CAST(Amount AS REAL)) AS Invoiced"]
["    FROM \"docs_invoices\"","    SELECT Customer,","      Customer,",null,null,null,"    FROM [Sheet Sales.F.Tutorial #3_Usin]"]
["    GROUP BY Customer","           SUM(CAST(Amount AS REAL)) AS Invoiced,","      SUM(Amount * 1) AS Invoiced,",null,null,null,"    GROUP BY Customer"]
["  ) a","           MAX(InvoiceDate) AS LastInvoiceDate","      MAX(InvoiceDate) AS LastInvoiceDate",null,null,null,"  ) a"]
["  LEFT JOIN (","    FROM docs_invoices","    FROM [docs_invoices.csv]",null,null,null,"  LEFT JOIN ("]
["    SELECT Customer, SUM(CAST(Amount AS REAL)) AS Paid","    GROUP BY Customer","    GROUP BY Customer",null,null,null,"    SELECT Customer, SUM(CAST(Amount AS REAL)) AS Paid"]
["    FROM \"docs_payments\"","  ) a","  ) AS a",null,null,null,"    FROM [Sheet Sales.E.Tutorial #3_Usin]"]
["    GROUP BY Customer","  LEFT JOIN (","  LEFT JOIN (",null,null,null,"    GROUP BY Customer"]
["  ) p","    SELECT Customer,","    SELECT",null,null,null,"  ) p"]
["    ON p.Customer = a.Customer","           SUM(CAST(Amount AS REAL)) AS Paid,","      Customer,",null,null,null,"    ON p.Customer = a.Customer"]
[null,"           MAX(PaymentDate) AS LastPaymentDate","      SUM(Amount * 1) AS Paid,"]
["  UNION ALL","    FROM docs_payments","      MAX(PaymentDate) AS LastPaymentDate",null,null,null,"  UNION ALL"]
[null,"    GROUP BY Customer","    FROM [docs_payments.csv]"]
["  /* payments-only side */","  ) p","    GROUP BY Customer",null,null,null,"  /* payments-only side */"]
["  SELECT","    ON p.Customer = a.Customer","  ) AS p",null,null,null,"  SELECT"]
["    p.Customer,",null,"    ON p.Customer = a.Customer",null,null,null,"    p.Customer,"]
["    0 AS Invoiced,","  UNION ALL",null,null,null,null,"    0 AS Invoiced,"]
["    p.Paid AS Paid,",null,"  UNION ALL",null,null,null,"    p.Paid AS Paid,"]
["    -p.Paid AS Variance","  /* customers that only have payments */",null,null,null,null,"    -p.Paid AS Variance"]
["  FROM (","  SELECT","  SELECT",null,null,null,"  FROM ("]
["    SELECT Customer, SUM(CAST(Amount AS REAL)) AS Paid","    p.Customer,","    p.Customer,",null,null,null,"    SELECT Customer, SUM(CAST(Amount AS REAL)) AS Paid"]
["    FROM \"docs_payments\"","    0 AS Invoiced,","    0 AS Invoiced,",null,null,null,"    FROM [Sheet Sales.E.Tutorial #3_Usin]"]
["    GROUP BY Customer","    p.Paid AS Paid,","    p.Paid AS Paid,",null,null,null,"    GROUP BY Customer"]
["  ) p","    -p.Paid AS Variance,","    -p.Paid AS Variance,",null,null,null,"  ) p"]
["  LEFT JOIN (","    NULL AS LastInvoiceDate,","    NULL AS LastInvoiceDate,",null,null,null,"  LEFT JOIN ("]
["    SELECT DISTINCT Customer FROM \"docs_invoices\"","    p.LastPaymentDate","    p.LastPaymentDate",null,null,null,"    SELECT DISTINCT Customer FROM [Sheet Sales.F.Tutorial #3_Usin]"]
["  ) a","  FROM (","  FROM (",null,null,null,"  ) a"]
["    ON a.Customer = p.Customer","    SELECT Customer,","    SELECT",null,null,null,"    ON a.Customer = p.Customer"]
["  WHERE a.Customer IS NULL","           SUM(CAST(Amount AS REAL)) AS Paid,","      Customer,",null,null,null,"  WHERE a.Customer IS NULL"]
[") z","           MAX(PaymentDate) AS LastPaymentDate","      SUM(Amount * 1) AS Paid,",null,null,null,") z"]
["ORDER BY ABS(Variance) DESC, Customer","    FROM docs_payments","      MAX(PaymentDate) AS LastPaymentDate",null,null,null,"ORDER BY ABS(Variance) DESC, Customer"]
[null,"    GROUP BY Customer","    FROM [docs_payments.csv]"]
[null,"  ) p","    GROUP BY Customer"]
[null,"  LEFT JOIN (SELECT DISTINCT Customer FROM docs_invoices) a","  ) AS p"]
[null,"    ON a.Customer = p.Customer","  LEFT JOIN ("]
[null,"  WHERE a.Customer IS NULL","    SELECT Customer FROM [docs_invoices.csv] GROUP BY Customer"]
[null,") z","  ) AS a"]
[null,"ORDER BY ABS(Variance) DESC, Customer","    ON a.Customer = p.Customer"]
[null,null,"  WHERE a.Customer IS NULL"]
[null,null,") z"]
[null,null,"ORDER BY ABS(Variance) DESC, Customer"]