Skip to content

Instantly share code, notes, and snippets.

View Sven-Bo's full-sized avatar
🤓
Automating Excel

Sven Sven-Bo

🤓
Automating Excel
View GitHub Profile
@Sven-Bo
Sven-Bo / excel-url-encode-decode.vb
Created February 28, 2025 03:15 — forked from jvarn/excel-url-encode-decode.vb
URL Encode and Decode VBA functions for Excel on Mac or Windows including UTF-8 support
Option Explicit
'------------------------------------------------------------------------------
' Module: URL Encode and Decode Functions
' Author: Jeremy Varnham
' Version: 1.1.0
' Date: 22 August 2024
' Description: This module provides two functions: URLEncode and URLDecode.
' These functions allow you to encode and decode URL strings,
' supporting ASCII, Unicode, and UTF-8 encoding.
@Sven-Bo
Sven-Bo / GetLocalOneDrivePath.bas.vb
Created September 7, 2024 10:30 — forked from guwidoe/GetLocalOneDrivePath.bas.vb
VBA Function to get the local path of a OneDrive/SharePoint synchronized Microsoft Office file
'Attribute VB_Name = "GetLocalOneDrivePath"
'
' Cross-platform VBA Function to get the local path of OneDrive/SharePoint
' synchronized Microsoft Office files (Works on Windows and on macOS)
'
' Author: Guido Witt-Dörring
' Created: 2022/07/01
' Updated: 2024/07/08
' License: MIT
'
@Sven-Bo
Sven-Bo / create_3d_pie_chart.py
Created June 24, 2024 17:30
This script demonstrates how to create a new Excel workbook, add data, insert a VBA macro, and execute it using the xlwings library in Python. The macro creates a 3D pie chart from the provided data.
"""
Author: Sven Bosau
YouTube Channel: https://youtube.com/@codingisfun
Website: https://pythonandvba.com
Does this help you? Consider buying me a coffee here:
https://pythonandvba.com/coffee-donation
This script creates a new Excel workbook, adds data, inserts a VBA macro, and executes it using the xlwings library. The VBA macro generates a 3D pie chart from the data.
"""
@Sven-Bo
Sven-Bo / BBC-Radio-HLS.m3u
Created June 23, 2024 07:37 — forked from bpsib/BBC-Radio-HLS.m3u
BBC Radio Streams
#EXTM3U
#EXTINF:-1,BBC - Radio 1
http://as-hls-ww-live.akamaized.net/pool_904/live/ww/bbc_radio_one/bbc_radio_one.isml/bbc_radio_one-audio%3d96000.norewind.m3u8
#EXTINF:-1,BBC - Radio 1Xtra
http://as-hls-ww-live.akamaized.net/pool_904/live/ww/bbc_1xtra/bbc_1xtra.isml/bbc_1xtra-audio%3d96000.norewind.m3u8
#EXTINF:-1,BBC - Radio 1Dance
http://as-hls-ww-live.akamaized.net/pool_904/live/ww/bbc_radio_one_dance/bbc_radio_one_dance.isml/bbc_radio_one_dance-audio%3d96000.norewind.m3u8
#EXTINF:-1,BBC - Radio 1Relax
http://as-hls-ww-live.akamaized.net/pool_904/live/ww/bbc_radio_one_relax/bbc_radio_one_relax.isml/bbc_radio_one_relax-audio%3d96000.norewind.m3u8
#EXTINF:-1,BBC - Radio 2
@Sven-Bo
Sven-Bo / data_entry_form_autofit_column.py
Created June 19, 2024 06:33
Modification of the initial code from the video tutorial "Simple Data Entry Form with PySimpleGUI and Pandas" (https://youtu.be/svcv8uub0D0). The enhancement allows the Excel columns to autofit their widths based on the content using the openpyxl library.
from pathlib import Path
import PySimpleGUI as sg
import pandas as pd
from openpyxl import load_workbook
# Add some color to the window
sg.theme('DarkTeal9')
current_dir = Path(__file__).parent if '__file__' in locals() else Path.cwd()
EXCEL_FILE = current_dir / 'Data_Entry.xlsx'
@Sven-Bo
Sven-Bo / append_df_to_excel_table.py
Created July 20, 2023 22:19
Python script to append DataFrame data to an Excel table using xlwings
# This code was provided by Sven Bosau
# Website: https://pythonandvba.com
# YouTube: https://youtube.com/@codingisfun
import xlwings as xw
import pandas as pd
# Constants
WORKBOOK_PATH = 'workbook.xlsx'
SHEET_NAME = 'Sheet1'
@Sven-Bo
Sven-Bo / find_replace_excel_values.py
Created July 1, 2023 06:41
Case-Insensitive Text Replacement in Excel Files using openpyxl
"""
Title: Case-Insensitive Text Replacement in Excel Files
Author: Sven Bosau
Website: https://pythonandvba.com
YouTube Channel: https://Youtube.com/@codingisfun
This script leverages the openpyxl library to perform case-insensitive replacement of text in Excel files (.xlsx, .xls).
It traverses each cell in each worksheet of an Excel file, compares the lowercase content of the cell to the keys
of a predefined dictionary, and if a match is found, replaces the cell's content with the corresponding value.
@Sven-Bo
Sven-Bo / pysimplegui_excel_entry_with_timestamp.py
Created May 29, 2023 09:20
This code is a modification of the initial code from the video tutorial titled "How to Create an Excel Data Entry Form in 10 Minutes Using Python (No VBA) | Easy & Simple" by Sven Bosau. It adds a timestamp next to the entry
"""
This code is a modification of the initial code from the video tutorial:
"How to Create an Excel Data Entry Form in 10 Minutes Using Python (No VBA) | Easy & Simple"
Video link: https://youtu.be/svcv8uub0D0
Modifications:
- Added a timestamp next to the entry in the Excel file
"""
from pathlib import Path
import PySimpleGUI as sg
@Sven-Bo
Sven-Bo / pysimplegui_excel_entry.py
Last active May 24, 2023 06:28
This code is a modification of the initial code from the video tutorial titled "How to Create an Excel Data Entry Form in 10 Minutes Using Python (No VBA) | Easy & Simple" by Sven Bosau. It adds a scrollbar to the main window layout using PySimpleGUI, allowing for easy navigation when filling out the form. The modified code provides an improved …
"""
This code is a modification of the initial code from the video tutorial:
"How to Create an Excel Data Entry Form in 10 Minutes Using Python (No VBA) | Easy & Simple"
Video link: https://youtu.be/svcv8uub0D0
Modifications:
- Added a scrollbar to the main window layout using sg.Column and sg.VerticalScroll.
"""
from pathlib import Path
@Sven-Bo
Sven-Bo / excel_data_entry.py
Created May 2, 2023 04:52
This Python script creates a data entry form using PySimpleGUI, allowing users to input, submit, clear, and delete data in an Excel file.
"""
This script is based on the original code from the YouTube tutorial:
- https://youtu.be/svcv8uub0D0
The initial code can be found on GitHub at:
- https://github.com/Sven-Bo/data-entry-form-pysimplegui
Modifications made to the original code:
- Added a "Delete Last Row" button to remove the last row from the Excel file.